Remove extraneous bracket directives

This commit is contained in:
Alex Dima 2016-12-31 00:20:31 +02:00
parent 21953fde00
commit 36b879e624
16 changed files with 172 additions and 171 deletions

View file

@ -61,8 +61,8 @@ export var language = <ILanguage> {
[/[ \t\r\n]+/, ''], [/[ \t\r\n]+/, ''],
// blocks // blocks
[/setlocal(?!\w)/, { token: 'keyword.tag-setlocal', bracket: '@open' }], [/setlocal(?!\w)/, 'keyword.tag-setlocal' ],
[/endlocal(?!\w)/, { token: 'keyword.tag-setlocal', bracket: '@close' }], [/endlocal(?!\w)/, 'keyword.tag-setlocal' ],
// words // words
[/[a-zA-Z_]\w*/, ''], [/[a-zA-Z_]\w*/, ''],

View file

@ -136,7 +136,7 @@ export var language = <ILanguage> {
[/@escapes/, 'string.escape'], [/@escapes/, 'string.escape'],
[/\./, 'string.escape.invalid'], [/\./, 'string.escape.invalid'],
[/#{/, { token: 'string.quote', bracket: '@open', next: 'root.interpolatedstring' } ], [/#{/, { token: 'string.quote', next: 'root.interpolatedstring' } ],
[/#/, 'string'] [/#/, 'string']
], ],
@ -147,7 +147,7 @@ export var language = <ILanguage> {
], ],
hereregexp: [ hereregexp: [
[/[^\\\/#]/, 'regexp'], [/[^\\\/#]+/, 'regexp'],
[/\\./, 'regexp'], [/\\./, 'regexp'],
[/#.*$/, 'comment'], [/#.*$/, 'comment'],
['///[igm]*', { token: 'regexp', next: '@pop' }], ['///[igm]*', { token: 'regexp', next: '@pop' }],

View file

@ -89,17 +89,17 @@ export var language = <ILanguage> {
// delimiters and operators // delimiters and operators
[/}/, { cases: { [/}/, { cases: {
'$S2==interpolatedstring' : { token: 'string.quote', bracket: '@close', next: '@pop' } '$S2==interpolatedstring' : { token: 'string.quote', next: '@pop' }
, '@default' : '@brackets' } }], , '@default' : '@brackets' } }],
[/[{}()\[\]]/, '@brackets'], [/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'], [/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter', '@default' : '' } } ], [/@symbols/, { cases: { '@operators': 'delimiter', '@default' : '' } } ],
// literal string // literal string
[/\@"/, { token: 'string.quote', bracket: '@open', next: '@litstring' } ], [/\@"/, { token: 'string.quote', next: '@litstring' } ],
// interpolated string // interpolated string
[/\$"/, { token: 'string.quote', bracket: '@open', next: '@interpolatedstring' } ], [/\$"/, { token: 'string.quote', next: '@interpolatedstring' } ],
// numbers // numbers
[/\d*\.\d+([eE][\-+]?\d+)?[fFdD]?/, 'number.float'], [/\d*\.\d+([eE][\-+]?\d+)?[fFdD]?/, 'number.float'],
@ -111,7 +111,7 @@ export var language = <ILanguage> {
// strings // strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string [/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, { token: 'string.quote', bracket: '@open', next: '@string' } ], [/"/, { token: 'string.quote', next: '@string' } ],
// characters // characters
[/'[^\\']'/, 'string'], [/'[^\\']'/, 'string'],
@ -146,13 +146,13 @@ export var language = <ILanguage> {
[/[^\\"]+/, 'string'], [/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'], [/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'], [/\\./, 'string.escape.invalid'],
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' } ] [/"/, { token: 'string.quote', next: '@pop' } ]
], ],
litstring: [ litstring: [
[/[^"]+/, 'string'], [/[^"]+/, 'string'],
[/""/, 'string.escape'], [/""/, 'string.escape'],
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' } ] [/"/, { token: 'string.quote', next: '@pop' } ]
], ],
interpolatedstring: [ interpolatedstring: [
@ -161,8 +161,8 @@ export var language = <ILanguage> {
[/\\./, 'string.escape.invalid'], [/\\./, 'string.escape.invalid'],
[/{{/, 'string.escape'], [/{{/, 'string.escape'],
[/}}/, 'string.escape'], [/}}/, 'string.escape'],
[/{/, { token: 'string.quote', bracket: '@open', next: 'root.interpolatedstring' } ], [/{/, { token: 'string.quote', next: 'root.interpolatedstring' } ],
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' } ] [/"/, { token: 'string.quote', next: '@pop' } ]
], ],
whitespace: [ whitespace: [

View file

@ -138,7 +138,7 @@ export var language = <IMonarchLanguage> {
comment: [ comment: [
['\\*\\/', 'comment', '@pop'], ['\\*\\/', 'comment', '@pop'],
['.', 'comment'] [/[^*/]+/, 'comment']
], ],
name: [ name: [
@ -183,13 +183,13 @@ export var language = <IMonarchLanguage> {
stringenddoublequote: [ stringenddoublequote: [
['\\\\.', 'string'], ['\\\\.', 'string'],
['"', { token: 'string', next: '@pop', bracket: '@close' }], ['"', { token: 'string', next: '@pop' }],
['.', 'string'] ['.', 'string']
], ],
stringendquote: [ stringendquote: [
['\\\\.', 'string'], ['\\\\.', 'string'],
['\'', { token: 'string', next: '@pop', bracket: '@close' }], ['\'', { token: 'string', next: '@pop' }],
['.', 'string'] ['.', 'string']
] ]
} }

View file

@ -96,7 +96,7 @@ export var language = <ILanguage> {
[/"/, 'string', '@string."' ], [/"/, 'string', '@string."' ],
// literal string // literal string
[/\@"/, { token: 'string.quote', bracket: '@open', next: '@litstring' }], [/\@"/, { token: 'string.quote', next: '@litstring' }],
// characters // characters
[/'[^\\']'B?/, 'string'], [/'[^\\']'B?/, 'string'],
@ -127,7 +127,7 @@ export var language = <ILanguage> {
litstring: [ litstring: [
[/[^"]+/, 'string'], [/[^"]+/, 'string'],
[/""/, 'string.escape'], [/""/, 'string.escape'],
[/"/, { token: 'string.quote', bracket: '@close', next: '@pop' } ] [/"/, { token: 'string.quote', next: '@pop' } ]
], ],
}, },
}; };

View file

@ -113,7 +113,7 @@ export var language = <ILanguage> {
// class // class
[/\.[a-zA-Z_-][\w-]*/, { cases: { '@eos': { token: 'tag.class', next: '@pop' }, '@default': 'tag.class' } }], [/\.[a-zA-Z_-][\w-]*/, { cases: { '@eos': { token: 'tag.class', next: '@pop' }, '@default': 'tag.class' } }],
// attributes // attributes
[/\(/, { token: 'delimiter.parenthesis', bracket: '@open', next: '@attributeList' }], [/\(/, { token: 'delimiter.parenthesis', next: '@attributeList' }],
], ],
simpleText: [ simpleText: [
@ -137,14 +137,14 @@ export var language = <ILanguage> {
[/,/, { cases: { '@eos': { token: 'attribute.delimiter', next: '@popall' }, '@default': 'attribute.delimiter' } }], [/,/, { cases: { '@eos': { token: 'attribute.delimiter', next: '@popall' }, '@default': 'attribute.delimiter' } }],
[/\)$/, { token: 'delimiter.parenthesis', bracket: '@close', next: '@popall' }], [/\)$/, { token: 'delimiter.parenthesis', next: '@popall' }],
[/\)/, { token: 'delimiter.parenthesis', bracket: '@close', next: '@pop' }], [/\)/, { token: 'delimiter.parenthesis', next: '@pop' }],
], ],
whitespace: [ whitespace: [
[/^(\s*)(\/\/.*)$/, { token: 'comment', next: '@blockText.$1.comment' } ], [/^(\s*)(\/\/.*)$/, { token: 'comment', next: '@blockText.$1.comment' } ],
[/[ \t\r\n]+/, ''], [/[ \t\r\n]+/, ''],
[/<!--/, { token: 'comment', bracket: '@open', next: '@comment' }], [/<!--/, { token: 'comment', next: '@comment' }],
], ],
blockText: [ blockText: [
@ -154,7 +154,7 @@ export var language = <ILanguage> {
comment: [ comment: [
[/[^<\-]+/, 'comment.content' ], [/[^<\-]+/, 'comment.content' ],
[/-->/, { token: 'comment', bracket: '@close', next: '@pop' } ], [/-->/, { token: 'comment', next: '@pop' } ],
[/<!--/, 'comment.content.invalid'], [/<!--/, 'comment.content.invalid'],
[/[<\-]/, 'comment.content' ] [/[<\-]/, 'comment.content' ]
], ],

View file

@ -57,7 +57,7 @@ export var language = <ILanguage> {
{ include: '@numbers' }, { include: '@numbers' },
['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', TOKEN_PROPERTY, '@attribute'], ['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', TOKEN_PROPERTY, '@attribute'],
['url(\\-prefix)?\\(', { token: 'tag', bracket: '@open', next: '@urldeclaration'}], ['url(\\-prefix)?\\(', { token: 'tag', next: '@urldeclaration'}],
['[{}()\\[\\]]', '@brackets'], ['[{}()\\[\\]]', '@brackets'],
['[,:;]', 'delimiter'], ['[,:;]', 'delimiter'],
@ -78,11 +78,11 @@ export var language = <ILanguage> {
nestedJSBegin: [ nestedJSBegin: [
['``', 'delimiter.backtick'], ['``', 'delimiter.backtick'],
['`', { token: 'delimiter.backtick', bracket: '@open', next: '@nestedJSEnd', nextEmbedded: 'text/javascript' }], ['`', { token: 'delimiter.backtick', next: '@nestedJSEnd', nextEmbedded: 'text/javascript' }],
], ],
nestedJSEnd: [ nestedJSEnd: [
['`', { token: 'delimiter.backtick', bracket: '@close', next: '@pop', nextEmbedded: '@pop' }], ['`', { token: 'delimiter.backtick', next: '@pop', nextEmbedded: '@pop' }],
], ],
operators: [ operators: [
@ -96,7 +96,7 @@ export var language = <ILanguage> {
urldeclaration: [ urldeclaration: [
{ include: '@strings'}, { include: '@strings'},
[ '[^)\r\n]+', 'string' ], [ '[^)\r\n]+', 'string' ],
['\\)', { token: 'tag', bracket: '@close', next: '@pop'}], ['\\)', { token: 'tag', next: '@pop'}],
], ],
attribute: <any[]>[ attribute: <any[]>[
@ -143,19 +143,19 @@ export var language = <ILanguage> {
], ],
strings: [ strings: [
<any[]>['~?"', { token: 'string.delimiter', bracket: '@open', next: '@stringsEndDoubleQuote' }], <any[]>['~?"', { token: 'string.delimiter', next: '@stringsEndDoubleQuote' }],
<any[]>['~?\'', { token: 'string.delimiter', bracket: '@open', next: '@stringsEndQuote' }] <any[]>['~?\'', { token: 'string.delimiter', next: '@stringsEndQuote' }]
], ],
stringsEndDoubleQuote: [ stringsEndDoubleQuote: [
['\\\\"', 'string'], ['\\\\"', 'string'],
<any[]>['"', { token: 'string.delimiter', next: '@popall', bracket: '@close' }], <any[]>['"', { token: 'string.delimiter', next: '@popall' }],
['.', 'string'] ['.', 'string']
], ],
stringsEndQuote: [ stringsEndQuote: [
['\\\\\'', 'string'], ['\\\\\'', 'string'],
<any[]>['\'', { token: 'string.delimiter', next: '@popall', bracket: '@close' }], <any[]>['\'', { token: 'string.delimiter', next: '@popall' }],
['.', 'string'] ['.', 'string']
], ],

View file

@ -132,10 +132,10 @@ export var language = <ILanguage>{
[/<(\w+)/, { [/<(\w+)/, {
cases: { cases: {
'@empty': { token: getTag('$1'), next: '@tag.$1' }, '@empty': { token: getTag('$1'), next: '@tag.$1' },
'@default': { token: getTag('$1'), bracket: '@open', next: '@tag.$1' } '@default': { token: getTag('$1'), next: '@tag.$1' }
} }
}], }],
[/<\/(\w+)\s*>/, { token: getTag('$1'), bracket: '@close' }], [/<\/(\w+)\s*>/, { token: getTag('$1') }],
[/<!--/, 'comment', '@comment'] [/<!--/, 'comment', '@comment']
], ],

View file

@ -472,23 +472,23 @@ export var language = <ILanguage> {
// NOTE: (*) is an invalid ML-like comment! // NOTE: (*) is an invalid ML-like comment!
{regex: /\(\*\)/, action: { token: 'invalid' }}, {regex: /\(\*\)/, action: { token: 'invalid' }},
{regex: /\(\*/, action: { token: 'comment', next: 'lexing_COMMENT_block_ml' } }, {regex: /\(\*/, action: { token: 'comment', next: 'lexing_COMMENT_block_ml' } },
{regex: /\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis', bracket: '@open' }*/ }, {regex: /\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ },
{regex: /\)/, action: '@brackets'/*{ token: 'delimiter.parenthesis', bracket: '@close' }*/ }, {regex: /\)/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ },
{regex: /\[/, action: '@brackets'/*{ token: 'delimiter.bracket', bracket: '@open' }*/ }, {regex: /\[/, action: '@brackets'/*{ token: 'delimiter.bracket' }*/ },
{regex: /\]/, action: '@brackets'/*{ token: 'delimiter.bracket', bracket: '@close' }*/ }, {regex: /\]/, action: '@brackets'/*{ token: 'delimiter.bracket' }*/ },
{regex: /\{/, action: '@brackets'/*{ token: 'delimiter.brace', bracket: '@open' }*/ }, {regex: /\{/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
{regex: /\}/, action: '@brackets'/*{ token: 'delimiter.brace', bracket: '@close' }*/ }, {regex: /\}/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
// lexing_COMMA // lexing_COMMA
{regex: /,\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis', bracket: '@open' }*/ }, // meta-programming syntax {regex: /,\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ }, // meta-programming syntax
{regex: /,/, action: { token: 'delimiter.comma' } }, {regex: /,/, action: { token: 'delimiter.comma' } },
{regex: /;/, action: { token: 'delimiter.semicolon' } }, {regex: /;/, action: { token: 'delimiter.semicolon' } },
// lexing_AT // lexing_AT
{regex: /@\(/, action: '@brackets'/* { token: 'delimiter.parenthesis', bracket: '@open' }*/ }, {regex: /@\(/, action: '@brackets'/* { token: 'delimiter.parenthesis' }*/ },
{regex: /@\[/, action: '@brackets'/* { token: 'delimiter.bracket', bracket: '@open' }*/ }, {regex: /@\[/, action: '@brackets'/* { token: 'delimiter.bracket' }*/ },
{regex: /@\{/, action: '@brackets'/*{ token: 'delimiter.brace', bracket: '@open' }*/ }, {regex: /@\{/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
// lexing_COLON // lexing_COLON
{regex: /:</, action: { token: 'keyword', next: '@lexing_EFFECT_commaseq0'} }, // T_COLONLT {regex: /:</, action: { token: 'keyword', next: '@lexing_EFFECT_commaseq0'} }, // T_COLONLT
@ -527,14 +527,14 @@ export var language = <ILanguage> {
}, },
// lexing_PERCENT: // lexing_PERCENT:
{regex: /%\(/, action: { token: 'delimiter.parenthesis', bracket: '@open' } }, {regex: /%\(/, action: { token: 'delimiter.parenthesis' } },
{regex: /^%{(#|\^|\$)?/, action: { token: 'keyword', bracket: '@open', next: '@lexing_EXTCODE', nextEmbedded: 'text/javascript' } }, {regex: /^%{(#|\^|\$)?/, action: { token: 'keyword', next: '@lexing_EXTCODE', nextEmbedded: 'text/javascript' } },
{regex: /^%}/, action: { token: 'keyword', bracket: '@close' } }, {regex: /^%}/, action: { token: 'keyword' } },
// lexing_QUOTE // lexing_QUOTE
{regex: /'\(/, action: { token: 'delimiter.parenthesis', bracket: '@open' } }, {regex: /'\(/, action: { token: 'delimiter.parenthesis' } },
{regex: /'\[/, action: { token: 'delimiter.bracket', bracket: '@open' } }, {regex: /'\[/, action: { token: 'delimiter.bracket' } },
{regex: /'\{/, action: { token: 'delimiter.brace', bracket: '@open' } }, {regex: /'\{/, action: { token: 'delimiter.brace' } },
[/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/, ['string', 'string.escape', 'string']], [/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/, ['string', 'string.escape', 'string']],
[/'[^\\']'/, 'string'], [/'[^\\']'/, 'string'],
@ -542,7 +542,7 @@ export var language = <ILanguage> {
[/"/, 'string.quote', '@lexing_DQUOTE'], [/"/, 'string.quote', '@lexing_DQUOTE'],
// lexing_BQUOTE // lexing_BQUOTE
{regex: /`\(/, action: '@brackets'/* { token: 'delimiter.parenthesis', bracket: '@open' }*/}, {regex: /`\(/, action: '@brackets'/* { token: 'delimiter.parenthesis' }*/},
// TODO: otherwise, try lexing_IDENT_sym // TODO: otherwise, try lexing_IDENT_sym
{regex: /\\/, action: { token: 'punctuation' } }, // just T_BACKSLASH {regex: /\\/, action: { token: 'punctuation' } }, // just T_BACKSLASH
@ -644,7 +644,7 @@ export var language = <ILanguage> {
], ],
lexing_DQUOTE: [ lexing_DQUOTE: [
{regex: /"/, action: { token: 'string.quote', bracket: '@close', next: '@pop' }}, {regex: /"/, action: { token: 'string.quote', next: '@pop' }},
// AS-20160628: additional hi-lighting for variables in staload/dynload strings // AS-20160628: additional hi-lighting for variables in staload/dynload strings
{regex: /(\{\$)(@IDENTFST@IDENTRST*)(\})/, action: [{token: 'string.escape'},{ token: 'identifier' },{token: 'string.escape'}]}, {regex: /(\{\$)(@IDENTFST@IDENTRST*)(\})/, action: [{token: 'string.escape'},{ token: 'identifier' },{token: 'string.escape'}]},
{regex: /\\$/, action: { token: 'string.escape' }}, {regex: /\\$/, action: { token: 'string.escape' }},

View file

@ -143,17 +143,17 @@ export var language = <ILanguage> {
// most complexity here is due to matching 'end' correctly with declarations. // most complexity here is due to matching 'end' correctly with declarations.
// We distinguish a declaration that comes first on a line, versus declarations further on a line (which are most likey modifiers) // We distinguish a declaration that comes first on a line, versus declarations further on a line (which are most likey modifiers)
[/^(\s*)([a-z_]\w*[!?=]?)/, ['white', [/^(\s*)([a-z_]\w*[!?=]?)/, ['white',
{ cases: { 'for|until|while': { token: 'keyword.$2', bracket: '@open', next: '@dodecl.$2' }, { cases: { 'for|until|while': { token: 'keyword.$2', next: '@dodecl.$2' },
'@declarations': { token: 'keyword.$2', bracket: '@open', next: '@root.$2' }, '@declarations': { token: 'keyword.$2', next: '@root.$2' },
'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, 'end': { token: 'keyword.$S2', next: '@pop' },
'@keywords': 'keyword', '@keywords': 'keyword',
'@builtins': 'predefined', '@builtins': 'predefined',
'@default': 'identifier' } }]], '@default': 'identifier' } }]],
[/[a-z_]\w*[!?=]?/, [/[a-z_]\w*[!?=]?/,
{ cases: { 'if|unless|while|until': { token: 'keyword.$0x', bracket: '@open', next: '@modifier.$0x' }, { cases: { 'if|unless|while|until': { token: 'keyword.$0x', next: '@modifier.$0x' },
'for': { token: 'keyword.$2', bracket: '@open', next: '@dodecl.$2' }, 'for': { token: 'keyword.$2', next: '@dodecl.$2' },
'@linedecls': { token: 'keyword.$0', bracket: '@open', next: '@root.$0' }, '@linedecls': { token: 'keyword.$0', next: '@root.$0' },
'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, 'end': { token: 'keyword.$S2', next: '@pop' },
'@keywords': 'keyword', '@keywords': 'keyword',
'@builtins': 'predefined', '@builtins': 'predefined',
'@default': 'identifier' } }], '@default': 'identifier' } }],
@ -164,29 +164,29 @@ export var language = <ILanguage> {
[/@@[\w]*/, 'namespace.class.identifier' ], // class [/@@[\w]*/, 'namespace.class.identifier' ], // class
// here document // here document
[/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ], [/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' } ],
[/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ], [/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' } ],
[/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', bracket: '@open', next: '@heredoc.$1' } ], [/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' } ],
// whitespace // whitespace
{ include: '@whitespace' }, { include: '@whitespace' },
// strings // strings
[/"/, { token: 'string.d.delim', bracket: '@open', next: '@dstring.d."'} ], [/"/, { token: 'string.d.delim', next: '@dstring.d."'} ],
[/'/, { token: 'string.sq.delim', bracket: '@open', next: '@sstring.sq' } ], [/'/, { token: 'string.sq.delim', next: '@sstring.sq' } ],
// % literals. For efficiency, rematch in the 'pstring' state // % literals. For efficiency, rematch in the 'pstring' state
[/%([rsqxwW]|Q?)/, { token: '@rematch', next: 'pstring' } ], [/%([rsqxwW]|Q?)/, { token: '@rematch', next: 'pstring' } ],
// commands and symbols // commands and symbols
[/`/, { token: 'string.x.delim', bracket: '@open', next: '@dstring.x.`' } ], [/`/, { token: 'string.x.delim', next: '@dstring.x.`' } ],
[/:(\w|[$@])\w*[!?=]?/, 'string.s'], [/:(\w|[$@])\w*[!?=]?/, 'string.s'],
[/:"/, { token: 'string.s.delim', bracket: '@open', next: '@dstring.s."' } ], [/:"/, { token: 'string.s.delim', next: '@dstring.s."' } ],
[/:'/, { token: 'string.s.delim', bracket: '@open', next: '@sstring.s' } ], [/:'/, { token: 'string.s.delim', next: '@sstring.s' } ],
// regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line // regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line
[/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', bracket: '@open', next: '@regexp' } ], [/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', next: '@regexp' } ],
// delimiters and operators // delimiters and operators
[/[{}()\[\]]/, '@brackets'], [/[{}()\[\]]/, '@brackets'],
@ -211,7 +211,7 @@ export var language = <ILanguage> {
// dodecl.<decl> where decl is the declarations started, like 'while' // dodecl.<decl> where decl is the declarations started, like 'while'
dodecl: [ dodecl: [
[/^/, { token: '', switchTo: '@root.$S2' }], // get out of do-skipping mode on a new line [/^/, { token: '', switchTo: '@root.$S2' }], // get out of do-skipping mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, // end on same line [/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', next: '@pop' }, // end on same line
'do' : { token: 'keyword', switchTo: '@root.$S2' }, // do on same line: not an open bracket here 'do' : { token: 'keyword', switchTo: '@root.$S2' }, // do on same line: not an open bracket here
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration on same line: rematch '@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration on same line: rematch
'@keywords': 'keyword', '@keywords': 'keyword',
@ -225,7 +225,7 @@ export var language = <ILanguage> {
// modifier.<decl>x where decl is the declaration starter, like 'if' // modifier.<decl>x where decl is the declaration starter, like 'if'
modifier: [ modifier: [
[/^/, '', '@pop'], // it was a modifier: get out of modifier mode on a new line [/^/, '', '@pop'], // it was a modifier: get out of modifier mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', bracket: '@close', next: '@pop' }, // end on same line [/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', next: '@pop' }, // end on same line
'then|else|elsif|do': { token: 'keyword', switchTo: '@root.$S2' }, // real declaration and not a modifier 'then|else|elsif|do': { token: 'keyword', switchTo: '@root.$S2' }, // real declaration and not a modifier
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration => not a modifier '@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration => not a modifier
'@keywords': 'keyword', '@keywords': 'keyword',
@ -240,7 +240,7 @@ export var language = <ILanguage> {
[/[^\\']+/, 'string.$S2' ], [/[^\\']+/, 'string.$S2' ],
[/\\\\|\\'|\\$/, 'string.$S2.escape'], [/\\\\|\\'|\\$/, 'string.$S2.escape'],
[/\\./, 'string.$S2.invalid'], [/\\./, 'string.$S2.invalid'],
[/'/, { token: 'string.$S2.delim', bracket: '@close', next: '@pop'} ] [/'/, { token: 'string.$S2.delim', next: '@pop'} ]
], ],
// double quoted "string". // double quoted "string".
@ -252,14 +252,14 @@ export var language = <ILanguage> {
[/\\$/, 'string.$S2.escape' ], [/\\$/, 'string.$S2.escape' ],
[/@escapes/, 'string.$S2.escape'], [/@escapes/, 'string.$S2.escape'],
[/\\./, 'string.$S2.escape.invalid'], [/\\./, 'string.$S2.escape.invalid'],
[/[`"]/, { cases: { '$#==$S3': { token: 'string.$S2.delim', bracket: '@close', next: '@pop'}, [/[`"]/, { cases: { '$#==$S3': { token: 'string.$S2.delim', next: '@pop'},
'@default': 'string.$S2' } } ] '@default': 'string.$S2' } } ]
], ],
// literal documents // literal documents
// heredoc.<close> where close is the closing delimiter // heredoc.<close> where close is the closing delimiter
heredoc: [ heredoc: [
[/^(\s*)(@heredelim)$/, { cases: { '$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', bracket: '@close', next: '@pop' }], [/^(\s*)(@heredelim)$/, { cases: { '$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', next: '@pop' }],
'@default': ['string.heredoc','string.heredoc'] }}], '@default': ['string.heredoc','string.heredoc'] }}],
[/.*/, 'string.heredoc' ], [/.*/, 'string.heredoc' ],
], ],
@ -269,13 +269,13 @@ export var language = <ILanguage> {
[/\$\w*/, 'global.constant', '@pop' ], [/\$\w*/, 'global.constant', '@pop' ],
[/@\w*/, 'namespace.class.identifier', '@pop' ], [/@\w*/, 'namespace.class.identifier', '@pop' ],
[/@@\w*/, 'namespace.instance.identifier', '@pop' ], [/@@\w*/, 'namespace.instance.identifier', '@pop' ],
[/[{]/, { token: 'string.escape.curly', bracket: '@open', switchTo: '@interpolated_compound' }], [/[{]/, { token: 'string.escape.curly', switchTo: '@interpolated_compound' }],
['', '', '@pop' ], // just a # is interpreted as a # ['', '', '@pop' ], // just a # is interpreted as a #
], ],
// any code // any code
interpolated_compound: [ interpolated_compound: [
[/[}]/, { token: 'string.escape.curly', bracket: '@close', next: '@pop'} ], [/[}]/, { token: 'string.escape.curly', next: '@pop'} ],
{ include: '@root' }, { include: '@root' },
], ],
@ -286,8 +286,8 @@ export var language = <ILanguage> {
// turns out that you can quote using regex control characters, aargh! // turns out that you can quote using regex control characters, aargh!
// for example; %r|kgjgaj| is ok (even though | is used for alternation) // for example; %r|kgjgaj| is ok (even though | is used for alternation)
// so, we need to match those first // so, we need to match those first
[/[^\(\{\[\\]/, { cases: { '$#==$S3' : { token: 'regexp.delim', bracket: '@close', next: '@pop' }, [/[^\(\{\[\\]/, { cases: { '$#==$S3' : { token: 'regexp.delim', next: '@pop' },
'$#==$S2' : { token: 'regexp.delim', bracket: '@open', next: '@push' }, // nested delimiters are allowed.. '$#==$S2' : { token: 'regexp.delim', next: '@push' }, // nested delimiters are allowed..
'~[)}\\]]' : '@brackets.regexp.escape.control', '~[)}\\]]' : '@brackets.regexp.escape.control',
'~@regexpctl': 'regexp.escape.control', '~@regexpctl': 'regexp.escape.control',
'@default': 'regexp' }}], '@default': 'regexp' }}],
@ -298,14 +298,14 @@ export var language = <ILanguage> {
regexp: [ regexp: [
{ include: '@regexcontrol' }, { include: '@regexcontrol' },
[/[^\\\/]/, 'regexp' ], [/[^\\\/]/, 'regexp' ],
['/[ixmp]*', { token: 'regexp.delim', bracket: '@close'}, '@pop' ], ['/[ixmp]*', { token: 'regexp.delim'}, '@pop' ],
], ],
regexcontrol: [ regexcontrol: [
[/(\{)(\d+(?:,\d*)?)(\})/, ['@brackets.regexp.escape.control', 'regexp.escape.control', '@brackets.regexp.escape.control'] ], [/(\{)(\d+(?:,\d*)?)(\})/, ['@brackets.regexp.escape.control', 'regexp.escape.control', '@brackets.regexp.escape.control'] ],
[/(\[)(\^?)/, ['@brackets.regexp.escape.control',{ token: 'regexp.escape.control', next: '@regexrange'}]], [/(\[)(\^?)/, ['@brackets.regexp.escape.control',{ token: 'regexp.escape.control', next: '@regexrange'}]],
[/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control'] ], [/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control'] ],
[/\(\?#/, { token: 'regexp.escape.control', bracket: '@open', next: '@regexpcomment' }], [/\(\?#/, { token: 'regexp.escape.control', next: '@regexpcomment' }],
[/[()]/, '@brackets.regexp.escape.control'], [/[()]/, '@brackets.regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'], [/@regexpctl/, 'regexp.escape.control'],
[/\\$/, 'regexp.escape' ], [/\\$/, 'regexp.escape' ],
@ -325,30 +325,30 @@ export var language = <ILanguage> {
regexpcomment: [ regexpcomment: [
[ /[^)]+/, 'comment' ], [ /[^)]+/, 'comment' ],
[ /\)/, { token: 'regexp.escape.control', bracket: '@close', next: '@pop' } ] [ /\)/, { token: 'regexp.escape.control', next: '@pop' } ]
], ],
// % quoted strings // % quoted strings
// A bit repetitive since we need to often special case the kind of ending delimiter // A bit repetitive since we need to often special case the kind of ending delimiter
pstring: [ pstring: [
[/%([qws])\(/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.(.)' } ], [/%([qws])\(/, { token: 'string.$1.delim', switchTo: '@qstring.$1.(.)' } ],
[/%([qws])\[/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.[.]' } ], [/%([qws])\[/, { token: 'string.$1.delim', switchTo: '@qstring.$1.[.]' } ],
[/%([qws])\{/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.{.}' } ], [/%([qws])\{/, { token: 'string.$1.delim', switchTo: '@qstring.$1.{.}' } ],
[/%([qws])</, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.<.>' } ], [/%([qws])</, { token: 'string.$1.delim', switchTo: '@qstring.$1.<.>' } ],
[/%([qws])(@delim)/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qstring.$1.$2.$2' } ], [/%([qws])(@delim)/, { token: 'string.$1.delim', switchTo: '@qstring.$1.$2.$2' } ],
[/%r\(/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.(.)' } ], [/%r\(/, { token: 'regexp.delim', switchTo: '@pregexp.(.)' } ],
[/%r\[/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.[.]' } ], [/%r\[/, { token: 'regexp.delim', switchTo: '@pregexp.[.]' } ],
[/%r\{/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.{.}' } ], [/%r\{/, { token: 'regexp.delim', switchTo: '@pregexp.{.}' } ],
[/%r</, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.<.>' } ], [/%r</, { token: 'regexp.delim', switchTo: '@pregexp.<.>' } ],
[/%r(@delim)/, { token: 'regexp.delim', bracket: '@open', switchTo: '@pregexp.$1.$1' } ], [/%r(@delim)/, { token: 'regexp.delim', switchTo: '@pregexp.$1.$1' } ],
[/%(x|W|Q?)\(/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.(.)' } ], [/%(x|W|Q?)\(/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.(.)' } ],
[/%(x|W|Q?)\[/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.[.]' } ], [/%(x|W|Q?)\[/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.[.]' } ],
[/%(x|W|Q?)\{/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.{.}' } ], [/%(x|W|Q?)\{/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.{.}' } ],
[/%(x|W|Q?)</, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.<.>' } ], [/%(x|W|Q?)</, { token: 'string.$1.delim', switchTo: '@qqstring.$1.<.>' } ],
[/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', bracket: '@open', switchTo: '@qqstring.$1.$2.$2' } ], [/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.$2.$2' } ],
[/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' } ], // recover [/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' } ], // recover
[/./, { token: 'invalid', next: '@pop' } ], // recover [/./, { token: 'invalid', next: '@pop' } ], // recover
@ -362,8 +362,8 @@ export var language = <ILanguage> {
qstring: [ qstring: [
[/\\$/, 'string.$S2.escape' ], [/\\$/, 'string.$S2.escape' ],
[/\\./, 'string.$S2.escape' ], [/\\./, 'string.$S2.escape' ],
[/./, { cases: { '$#==$S4' : { token: 'string.$S2.delim', bracket: '@close', next: '@pop' }, [/./, { cases: { '$#==$S4' : { token: 'string.$S2.delim', next: '@pop' },
'$#==$S3' : { token: 'string.$S2.delim', bracket: '@open', next: '@push' }, // nested delimiters are allowed.. '$#==$S3' : { token: 'string.$S2.delim', next: '@push' }, // nested delimiters are allowed..
'@default': 'string.$S2' }}], '@default': 'string.$S2' }}],
], ],

View file

@ -61,13 +61,13 @@ export var language = <IMonarchLanguage> {
['[@](charset|namespace)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }], ['[@](charset|namespace)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
['[@](function)', { token: TOKEN_AT_KEYWORD, next: '@functiondeclaration' }], ['[@](function)', { token: TOKEN_AT_KEYWORD, next: '@functiondeclaration' }],
['[@](mixin)', { token: TOKEN_AT_KEYWORD, next: '@mixindeclaration' }], ['[@](mixin)', { token: TOKEN_AT_KEYWORD, next: '@mixindeclaration' }],
['url(\\-prefix)?\\(', { token: 'meta', bracket: '@open', next: '@urldeclaration' }], ['url(\\-prefix)?\\(', { token: 'meta', next: '@urldeclaration' }],
{ include: '@controlstatement' }, // sass control statements { include: '@controlstatement' }, // sass control statements
{ include: '@selectorname' }, { include: '@selectorname' },
['[&\\*]', TOKEN_SELECTOR_TAG], // selector symbols ['[&\\*]', TOKEN_SELECTOR_TAG], // selector symbols
['[>\\+,]', 'delimiter'], // selector operators ['[>\\+,]', 'delimiter'], // selector operators
['\\[', { token: 'delimiter.bracket', bracket: '@open', next: '@selectorattribute' }], ['\\[', { token: 'delimiter.bracket', next: '@selectorattribute' }],
['{', { token: 'delimiter.curly', bracket: '@open', next: '@selectorbody' }], ['{', { token: 'delimiter.curly', next: '@selectorbody' }],
], ],
selectorbody: [ selectorbody: [
@ -75,22 +75,22 @@ export var language = <IMonarchLanguage> {
{ include: '@selector' }, // sass: nested selectors { include: '@selector' }, // sass: nested selectors
['[@](extend)', { token: TOKEN_AT_KEYWORD, next: '@extendbody' }], // sass: extend other selectors ['[@](extend)', { token: TOKEN_AT_KEYWORD, next: '@extendbody' }], // sass: extend other selectors
['[@](return)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }], ['[@](return)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
['}', { token: 'delimiter.curly', bracket: '@close', next: '@pop' }], ['}', { token: 'delimiter.curly', next: '@pop' }],
], ],
selectorname: [ selectorname: [
['#{', { token: 'meta', bracket: '@open', next: '@variableinterpolation' }], // sass: interpolation ['#{', { token: 'meta', next: '@variableinterpolation' }], // sass: interpolation
['(\\.|#(?=[^{])|%|(@identifier)|:)+', TOKEN_SELECTOR], // selector (.foo, div, ...) ['(\\.|#(?=[^{])|%|(@identifier)|:)+', TOKEN_SELECTOR], // selector (.foo, div, ...)
], ],
selectorattribute: [ selectorattribute: [
{ include: '@term' }, { include: '@term' },
[']', { token: 'delimiter.bracket', bracket: '@close', next: '@pop' }], [']', { token: 'delimiter.bracket', next: '@pop' }],
], ],
term: [ term: [
{ include: '@comments' }, { include: '@comments' },
['url(\\-prefix)?\\(', { token: 'meta', bracket: '@open', next: '@urldeclaration' }], ['url(\\-prefix)?\\(', { token: 'meta', next: '@urldeclaration' }],
{ include: '@functioninvocation' }, { include: '@functioninvocation' },
{ include: '@numbers' }, { include: '@numbers' },
{ include: '@strings' }, { include: '@strings' },
@ -100,21 +100,21 @@ export var language = <IMonarchLanguage> {
['([<>=\\+\\-\\*\\/\\^\\|\\~,])', 'operator'], ['([<>=\\+\\-\\*\\/\\^\\|\\~,])', 'operator'],
[',', 'delimiter'], [',', 'delimiter'],
['!default', 'literal'], ['!default', 'literal'],
['\\(', { token: 'delimiter.parenthesis', bracket: '@open', next: '@parenthizedterm' }], ['\\(', { token: 'delimiter.parenthesis', next: '@parenthizedterm' }],
], ],
rulevalue: [ rulevalue: [
{ include: '@term' }, { include: '@term' },
['!important', 'literal'], ['!important', 'literal'],
[';', 'delimiter', '@pop'], [';', 'delimiter', '@pop'],
['{', { token: 'delimiter.curly', bracket: '@open', switchTo: '@nestedproperty' }], // sass: nested properties ['{', { token: 'delimiter.curly', switchTo: '@nestedproperty' }], // sass: nested properties
['(?=})', { token: '', next: '@pop' }], // missing semicolon ['(?=})', { token: '', next: '@pop' }], // missing semicolon
], ],
nestedproperty: [ nestedproperty: [
['[*_]?@identifier@ws:', TOKEN_PROPERTY, '@rulevalue'], ['[*_]?@identifier@ws:', TOKEN_PROPERTY, '@rulevalue'],
{ include: '@comments' }, { include: '@comments' },
['}', { token: 'delimiter.curly', bracket: '@close', next: '@pop' }], ['}', { token: 'delimiter.curly', next: '@pop' }],
], ],
warndebug: [ warndebug: [
@ -132,12 +132,12 @@ export var language = <IMonarchLanguage> {
urldeclaration: [ urldeclaration: [
{ include: '@strings' }, { include: '@strings' },
['[^)\r\n]+', 'string'], ['[^)\r\n]+', 'string'],
['\\)', { token: 'meta', bracket: '@close', next: '@pop' }], ['\\)', { token: 'meta', next: '@pop' }],
], ],
parenthizedterm: [ parenthizedterm: [
{ include: '@term' }, { include: '@term' },
['\\)', { token: 'delimiter.parenthesis', bracket: '@close', next: '@pop' }], ['\\)', { token: 'delimiter.parenthesis', next: '@pop' }],
], ],
declarationbody: [ declarationbody: [
@ -156,12 +156,12 @@ export var language = <IMonarchLanguage> {
variablereference: [ // sass variable reference variablereference: [ // sass variable reference
['\\$@identifier', 'variable.ref'], ['\\$@identifier', 'variable.ref'],
['\\.\\.\\.', 'operator'], // var args in reference ['\\.\\.\\.', 'operator'], // var args in reference
['#{', { token: 'meta', bracket: '@open', next: '@variableinterpolation' }], // sass var resolve ['#{', { token: 'meta', next: '@variableinterpolation' }], // sass var resolve
], ],
variableinterpolation: [ variableinterpolation: [
{ include: '@variablereference' }, { include: '@variablereference' },
['}', { token: 'meta', bracket: '@close', next: '@pop' }], ['}', { token: 'meta', next: '@pop' }],
], ],
comments: [ comments: [
@ -188,16 +188,16 @@ export var language = <IMonarchLanguage> {
], ],
functiondeclaration: [ functiondeclaration: [
['@identifier@ws\\(', { token: 'meta', bracket: '@open', next: '@parameterdeclaration' }], ['@identifier@ws\\(', { token: 'meta', next: '@parameterdeclaration' }],
['{', { token: 'delimiter.curly', bracket: '@open', switchTo: '@functionbody' }], ['{', { token: 'delimiter.curly', switchTo: '@functionbody' }],
], ],
mixindeclaration: [ mixindeclaration: [
// mixin with parameters // mixin with parameters
['@identifier@ws\\(', { token: 'meta', bracket: '@open', next: '@parameterdeclaration' }], ['@identifier@ws\\(', { token: 'meta', next: '@parameterdeclaration' }],
// mixin without parameters // mixin without parameters
['@identifier', 'meta'], ['@identifier', 'meta'],
['{', { token: 'delimiter.curly', bracket: '@open', switchTo: '@selectorbody' }], ['{', { token: 'delimiter.curly', switchTo: '@selectorbody' }],
], ],
parameterdeclaration: [ parameterdeclaration: [
@ -205,7 +205,7 @@ export var language = <IMonarchLanguage> {
['\\.\\.\\.', 'operator'], // var args in declaration ['\\.\\.\\.', 'operator'], // var args in declaration
[',', 'delimiter'], [',', 'delimiter'],
{ include: '@term' }, { include: '@term' },
['\\)', { token: 'meta', bracket: '@close', next: '@pop' }], ['\\)', { token: 'meta', next: '@pop' }],
], ],
includedeclaration: [ includedeclaration: [
@ -213,18 +213,18 @@ export var language = <IMonarchLanguage> {
['@identifier', 'meta'], ['@identifier', 'meta'],
[';', 'delimiter', '@pop'], [';', 'delimiter', '@pop'],
['(?=})', { token: '', next: '@pop' }], // missing semicolon ['(?=})', { token: '', next: '@pop' }], // missing semicolon
['{', { token: 'delimiter.curly', bracket: '@open', switchTo: '@selectorbody' }], ['{', { token: 'delimiter.curly', switchTo: '@selectorbody' }],
], ],
keyframedeclaration: [ keyframedeclaration: [
['@identifier', 'meta'], ['@identifier', 'meta'],
['{', { token: 'delimiter.curly', bracket: '@open', switchTo: '@keyframebody' }], ['{', { token: 'delimiter.curly', switchTo: '@keyframebody' }],
], ],
keyframebody: [ keyframebody: [
{ include: '@term' }, { include: '@term' },
['{', { token: 'delimiter.curly', bracket: '@open', next: '@selectorbody' }], ['{', { token: 'delimiter.curly', next: '@selectorbody' }],
['}', { token: 'delimiter.curly', bracket: '@close', next: '@pop' }], ['}', { token: 'delimiter.curly', next: '@pop' }],
], ],
controlstatement: [ controlstatement: [
@ -234,7 +234,7 @@ export var language = <IMonarchLanguage> {
controlstatementdeclaration: [ controlstatementdeclaration: [
['(in|from|through|if|to)\\b', { token: 'keyword.flow' }], ['(in|from|through|if|to)\\b', { token: 'keyword.flow' }],
{ include: '@term' }, { include: '@term' },
['{', { token: 'delimiter.curly', bracket: '@open', switchTo: '@selectorbody' }], ['{', { token: 'delimiter.curly', switchTo: '@selectorbody' }],
], ],
functionbody: [ functionbody: [
@ -243,34 +243,34 @@ export var language = <IMonarchLanguage> {
{ include: '@term' }, { include: '@term' },
{ include: '@controlstatement' }, { include: '@controlstatement' },
[';', 'delimiter'], [';', 'delimiter'],
['}', { token: 'delimiter.curly', bracket: '@close', next: '@pop' }], ['}', { token: 'delimiter.curly', next: '@pop' }],
], ],
functioninvocation: [ functioninvocation: [
['@identifier\\(', { token: 'meta', bracket: '@open', next: '@functionarguments' }], ['@identifier\\(', { token: 'meta', next: '@functionarguments' }],
], ],
functionarguments: [ functionarguments: [
['\\$@identifier@ws:', TOKEN_PROPERTY], ['\\$@identifier@ws:', TOKEN_PROPERTY],
['[,]', 'delimiter'], ['[,]', 'delimiter'],
{ include: '@term' }, { include: '@term' },
['\\)', { token: 'meta', bracket: '@close', next: '@pop' }], ['\\)', { token: 'meta', next: '@pop' }],
], ],
strings: [ strings: [
['~?"', { token: 'string.delimiter', bracket: '@open', next: '@stringenddoublequote' }], ['~?"', { token: 'string.delimiter', next: '@stringenddoublequote' }],
['~?\'', { token: 'string.delimiter', bracket: '@open', next: '@stringendquote' }] ['~?\'', { token: 'string.delimiter', next: '@stringendquote' }]
], ],
stringenddoublequote: [ stringenddoublequote: [
['\\\\.', 'string'], ['\\\\.', 'string'],
['"', { token: 'string.delimiter', next: '@pop', bracket: '@close' }], ['"', { token: 'string.delimiter', next: '@pop' }],
['.', 'string'] ['.', 'string']
], ],
stringendquote: [ stringendquote: [
['\\\\.', 'string'], ['\\\\.', 'string'],
['\'', { token: 'string.delimiter', next: '@pop', bracket: '@close' }], ['\'', { token: 'string.delimiter', next: '@pop' }],
['.', 'string'] ['.', 'string']
] ]
} }

View file

@ -1073,14 +1073,14 @@ export var language = <ILanguage> {
], ],
comments: [ comments: [
[/--+.*/, 'comment'], [/--+.*/, 'comment'],
[/\/\*/, { token: 'comment.quote', bracket: '@open', next: '@comment' }] [/\/\*/, { token: 'comment.quote', next: '@comment' }]
], ],
comment: [ comment: [
[/[^*/]+/, 'comment'], [/[^*/]+/, 'comment'],
// Not supporting nested comments, as nested comments seem to not be standard? // Not supporting nested comments, as nested comments seem to not be standard?
// i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic
// [/\/\*/, { token: 'comment.quote', bracket: '@open', next: '@push' }], // nested comment not allowed :-( // [/\/\*/, { token: 'comment.quote', next: '@push' }], // nested comment not allowed :-(
[/\*\//, { token: 'comment.quote', bracket: '@close', next: '@pop' }], [/\*\//, { token: 'comment.quote', next: '@pop' }],
[/./, 'comment'] [/./, 'comment']
], ],
pseudoColumns: [ pseudoColumns: [
@ -1095,38 +1095,38 @@ export var language = <ILanguage> {
[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number'] [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number']
], ],
strings: [ strings: [
[/N'/, { token: 'string.quote', bracket: '@open', next: '@string' }], [/N'/, { token: 'string.quote', next: '@string' }],
[/'/, { token: 'string.quote', bracket: '@open', next: '@string' }] [/'/, { token: 'string.quote', next: '@string' }]
], ],
string: [ string: [
[/[^']+/, 'string'], [/[^']+/, 'string'],
[/''/, 'string'], [/''/, 'string'],
[/'/, { token: 'string.quote', bracket: '@close', next: '@pop' }] [/'/, { token: 'string.quote', next: '@pop' }]
], ],
complexIdentifiers: [ complexIdentifiers: [
[/\[/, { token: 'identifier.quote', bracket: '@open', next: '@bracketedIdentifier' }], [/\[/, { token: 'identifier.quote', next: '@bracketedIdentifier' }],
[/"/, { token: 'identifier.quote', bracket: '@open', next: '@quotedIdentifier' }] [/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }]
], ],
bracketedIdentifier: [ bracketedIdentifier: [
[/[^\]]+/, 'identifier'], [/[^\]]+/, 'identifier'],
[/]]/, 'identifier'], [/]]/, 'identifier'],
[/]/, { token: 'identifier.quote', bracket: '@close', next: '@pop' }] [/]/, { token: 'identifier.quote', next: '@pop' }]
], ],
quotedIdentifier: [ quotedIdentifier: [
[/[^"]+/, 'identifier'], [/[^"]+/, 'identifier'],
[/""/, 'identifier'], [/""/, 'identifier'],
[/"/, { token: 'identifier.quote', bracket: '@close', next: '@pop' }] [/"/, { token: 'identifier.quote', next: '@pop' }]
], ],
scopes: [ scopes: [
[/BEGIN\s+(DISTRIBUTED\s+)?TRAN(SACTION)?\b/i, 'keyword'], [/BEGIN\s+(DISTRIBUTED\s+)?TRAN(SACTION)?\b/i, 'keyword'],
[/BEGIN\s+TRY\b/i, { token: 'keyword.try', bracket: '@open' }], [/BEGIN\s+TRY\b/i, { token: 'keyword.try' }],
[/END\s+TRY\b/i, { token: 'keyword.try', bracket: '@close' }], [/END\s+TRY\b/i, { token: 'keyword.try' }],
[/BEGIN\s+CATCH\b/i, { token: 'keyword.catch', bracket: '@open' }], [/BEGIN\s+CATCH\b/i, { token: 'keyword.catch' }],
[/END\s+CATCH\b/i, { token: 'keyword.catch', bracket: '@close' }], [/END\s+CATCH\b/i, { token: 'keyword.catch' }],
[/(BEGIN|CASE)\b/i, { token: 'keyword.block', bracket: '@open' }], [/(BEGIN|CASE)\b/i, { token: 'keyword.block' }],
[/END\b/i, { token: 'keyword.block', bracket: '@close' }], [/END\b/i, { token: 'keyword.block' }],
[/WHEN\b/i, { token: 'keyword.choice', bracket: '@open' }], [/WHEN\b/i, { token: 'keyword.choice' }],
[/THEN\b/i, { token: 'keyword.choice', bracket: '@close' }] [/THEN\b/i, { token: 'keyword.choice' }]
] ]
} }
}; };

View file

@ -97,7 +97,7 @@ export var language = <ILanguage> {
], ],
literal: [ literal: [
[ /"/, { token: 'string.quote', bracket: '@open', next: '@stringlit' } ], [ /"/, { token: 'string.quote', next: '@stringlit' } ],
[ /0[b]([01]_?)+/, 'number.binary' ], [ /0[b]([01]_?)+/, 'number.binary' ],
[ /0[o]([0-7]_?)+/, 'number.octal' ], [ /0[o]([0-7]_?)+/, 'number.octal' ],
[ /0[x]([0-9a-fA-F]_?)+([pP][\-+](\d_?)+)?/, 'number.hex' ], [ /0[x]([0-9a-fA-F]_?)+([pP][\-+](\d_?)+)?/, 'number.hex' ],
@ -106,28 +106,28 @@ export var language = <ILanguage> {
], ],
stringlit: [ stringlit: [
[ /\\\(/, { token: 'operator', bracket: '@open', next: '@interpolatedexpression' } ], [ /\\\(/, { token: 'operator', next: '@interpolatedexpression' } ],
[ /@escapes/, 'string' ], [ /@escapes/, 'string' ],
[ /\\./, 'string.escape.invalid' ], [ /\\./, 'string.escape.invalid' ],
[ /"/, { token: 'string.quote', bracket: '@close', next: '@pop' } ], [ /"/, { token: 'string.quote', next: '@pop' } ],
[ /./, 'string' ] [ /./, 'string' ]
], ],
interpolatedexpression: [ interpolatedexpression: [
[ /\(/, { token: 'operator', bracket: '@open', next: '@interpolatedexpression' } ], [ /\(/, { token: 'operator', next: '@interpolatedexpression' } ],
[ /\)/, { token: 'operator', bracket: '@close', next: '@pop' } ], [ /\)/, { token: 'operator', next: '@pop' } ],
{ include: '@literal' }, { include: '@literal' },
{ include: '@keyword' }, { include: '@keyword' },
{ include: '@symbol' } { include: '@symbol' }
], ],
keyword: [ keyword: [
[ /`/, { token: 'operator', bracket: '@open', next: '@escapedkeyword' } ], [ /`/, { token: 'operator', next: '@escapedkeyword' } ],
[ /@identifier/, { cases: { '@keywords': 'keyword', '[A-Z][\a-zA-Z0-9$]*': 'type.identifier', '@default': 'identifier' } }] [ /@identifier/, { cases: { '@keywords': 'keyword', '[A-Z][\a-zA-Z0-9$]*': 'type.identifier', '@default': 'identifier' } }]
], ],
escapedkeyword: [ escapedkeyword: [
[ /`/, { token: 'operator', bracket: '@close', next: '@pop' } ], [ /`/, { token: 'operator', next: '@pop' } ],
[ /./, 'identifier' ] [ /./, 'identifier' ]
], ],

View file

@ -130,14 +130,14 @@ export var language = <ILanguage> {
{ include: '@whitespace' }, { include: '@whitespace' },
// special ending tag-words // special ending tag-words
[/next(?!\w)/, { token: 'keyword.tag-for', bracket: '@close'}], [/next(?!\w)/, { token: 'keyword.tag-for'}],
[/loop(?!\w)/, { token: 'keyword.tag-do', bracket: '@close' }], [/loop(?!\w)/, { token: 'keyword.tag-do' }],
// usual ending tags // usual ending tags
[/end\s+(?!for|do)([a-zA-Z_]\w*)/, { token: 'keyword.tag-$1', bracket: '@close' }], [/end\s+(?!for|do)([a-zA-Z_]\w*)/, { token: 'keyword.tag-$1' }],
// identifiers, tagwords, and keywords // identifiers, tagwords, and keywords
[/[a-zA-Z_]\w*/, { cases: { '@tagwords': {token:'keyword.tag-$0', bracket: '@open'}, [/[a-zA-Z_]\w*/, { cases: { '@tagwords': {token:'keyword.tag-$0'},
'@keywords': {token:'keyword.$0'}, '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }], '@default': 'identifier' } }],

View file

@ -44,35 +44,35 @@ export var language = <ILanguage> {
// Standard opening tag // Standard opening tag
[/(<)(@qualifiedName)/, [ [/(<)(@qualifiedName)/, [
{ token: 'delimiter.start', bracket: '@open' }, { token: 'delimiter.start' },
{ token: 'tag.tag-$2', bracket: '@open', next: '@tag.$2' }]], { token: 'tag.tag-$2', next: '@tag.$2' }]],
// Standard closing tag // Standard closing tag
[/(<\/)(@qualifiedName)(\s*)(>)/, [ [/(<\/)(@qualifiedName)(\s*)(>)/, [
{ token: 'delimiter.end', bracket: '@open' }, { token: 'delimiter.end' },
{ token: 'tag.tag-$2', bracket: '@close' }, { token: 'tag.tag-$2' },
'', '',
{ token: 'delimiter.end', bracket: '@close' }]], { token: 'delimiter.end' }]],
// Meta tags - instruction // Meta tags - instruction
[/(<\?)(@qualifiedName)/, [ [/(<\?)(@qualifiedName)/, [
{ token: 'delimiter.start', bracket: '@open' }, { token: 'delimiter.start' },
{ token: 'metatag.instruction', next: '@tag' }]], { token: 'metatag.instruction', next: '@tag' }]],
// Meta tags - declaration // Meta tags - declaration
[/(<\!)(@qualifiedName)/, [ [/(<\!)(@qualifiedName)/, [
{ token: 'delimiter.start', bracket: '@open' }, { token: 'delimiter.start' },
{ token: 'metatag.declaration', next: '@tag' }]], { token: 'metatag.declaration', next: '@tag' }]],
// CDATA // CDATA
[/<\!\[CDATA\[/, { token: 'delimiter.cdata', bracket: '@open', next: '@cdata' }], [/<\!\[CDATA\[/, { token: 'delimiter.cdata', next: '@cdata' }],
[/&\w+;/, 'string.escape'], [/&\w+;/, 'string.escape'],
], ],
cdata: [ cdata: [
[/[^\]]+/, ''], [/[^\]]+/, ''],
[/\]\]>/, { token: 'delimiter.cdata', bracket: '@close', next: '@pop' }], [/\]\]>/, { token: 'delimiter.cdata', next: '@pop' }],
[/\]/, ''] [/\]/, '']
], ],
@ -82,21 +82,21 @@ export var language = <ILanguage> {
[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/, ['attribute.name', '', 'attribute.value']], [/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/, ['attribute.name', '', 'attribute.value']],
[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/, ['attribute.name', '', 'attribute.value']], [/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/, ['attribute.name', '', 'attribute.value']],
[/@qualifiedName/, 'attribute.name'], [/@qualifiedName/, 'attribute.name'],
[/\?>/, { token: 'delimiter.start', bracket: '@close', next: '@pop' }], [/\?>/, { token: 'delimiter.start', next: '@pop' }],
[/(\/)(>)/, [ [/(\/)(>)/, [
{ token: 'tag.tag-$S2', bracket: '@close' }, { token: 'tag.tag-$S2' },
{ token: 'delimiter.start', bracket: '@close', next: '@pop' }]], { token: 'delimiter.start', next: '@pop' }]],
[/>/, { token: 'delimiter.start', bracket: '@close', next: '@pop' }], [/>/, { token: 'delimiter.start', next: '@pop' }],
], ],
whitespace: [ whitespace: [
[/[ \t\r\n]+/, ''], [/[ \t\r\n]+/, ''],
[/<!--/, { token: 'comment', bracket: '@open', next: '@comment' }] [/<!--/, { token: 'comment', next: '@comment' }]
], ],
comment: [ comment: [
[/[^<\-]+/, 'comment.content' ], [/[^<\-]+/, 'comment.content' ],
[/-->/, { token: 'comment', bracket: '@close', next: '@pop' } ], [/-->/, { token: 'comment', next: '@pop' } ],
[/<!--/, 'comment.content.invalid'], [/<!--/, 'comment.content.invalid'],
[/[<\-]/, 'comment.content' ] [/[<\-]/, 'comment.content' ]
], ],

View file

@ -4,7 +4,8 @@ var jsdom = require('jsdom-no-contextify');
requirejs.config({ requirejs.config({
baseUrl: '', baseUrl: '',
paths: { paths: {
'vs': 'node_modules/monaco-editor-core/dev/vs' 'vs': '../vscode/out/vs'
// 'vs': 'node_modules/monaco-editor-core/dev/vs'
}, },
nodeRequire: require nodeRequire: require
}); });