Monaco Editor - Adding monarch multi-line string token for Lua

Viewed 460

So i'm creating a 'lua' tokenizer using Monarch and Monaco editor, I have the basic variables and stuff setup, but the only problem is I have no idea how to add a multi-line string.

I see they did it with their own monaco but that is using the same character which is ` however for lua to create a multi-line string you need to use [[ and close it with ]]

Image of javascript multiline in their example. https://i.imgur.com/iZufBn9.png

This is (from my understanding) the tokens they used in Monarch

// strings
[/`/, 'string', '@string_backtick'],

string_backtick: [
    [/\$\{/, { token: 'delimiter.bracket', next: '@bracketCounting' }],
    [/[^\\`$]+/, 'string'],
    [/@escapes/, 'string.escape'],
    [/\\./, 'string.escape.invalid'],
    [/`/, 'string', '@pop']
],
0 Answers
Related