diff --git a/Syntaxes/JavaScript Basic.tmLanguage b/Syntaxes/JavaScript Basic.tmLanguage index 7d5e1e8..5b3fc51 100644 --- a/Syntaxes/JavaScript Basic.tmLanguage +++ b/Syntaxes/JavaScript Basic.tmLanguage @@ -30,6 +30,14 @@ Embedded JavaScript patterns + + include + #comments + + + include + #support + include #core @@ -38,10 +46,6 @@ include #special - - include - #support - include #sugar @@ -49,41 +53,7 @@ repository - core - - patterns - - - include - #core-comments - - - include - #core-number - - - include - #core-string - - - include - #core-regex - - - include - #core-function - - - include - #core-keywords - - - include - #core-punctuation - - - - core-comments + comments patterns @@ -158,7 +128,72 @@ - core-function + core + + patterns + + + include + #literal-number + + + include + #literal-string + + + include + #literal-regex + + + include + #literal-function-call + + + include + #literal-function-constructor + + + include + #literal-keywords + + + include + #literal-labels + + + include + #literal-variable + + + include + #literal-punctuation + + + + literal-function-call + + patterns + + + begin + (?=[_$a-zA-Z][_$\w]*\s*\() + end + (?=\() + name + meta.function-call.static.with-arguments.js + patterns + + + match + [_$a-zA-Z][_$\w]* + name + entity.name.function.js + + + + + + literal-function-constructor patterns @@ -451,7 +486,7 @@ - core-keywords + literal-keywords patterns @@ -466,7 +501,7 @@ 2 name - entity.name.type.instance.js + entity.name.type.class.js match @@ -494,7 +529,7 @@ match - \b(delete|in|instanceof|new|typeof|with)\b + \b(delete|in(stanceof)?|new|typeof|void|with)\b name keyword.operator.js @@ -518,25 +553,170 @@ match - \b(super|this)\b + \bundefined\b + name + constant.language.null.js + + + match + \bNaN\b + name + constant.language.null.js + + + match + (?<!\.)\b(super|this|arguments)\b name variable.language.js match - !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b + (?<=\.)\b(prototype|constructor)\b + name + variable.language.js + + + disabled + 1 + match + !|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|/=|%=|\+=|\-=|&=|\^= name keyword.operator.js + disabled + 1 match - \b(NaN|undefined)\b + : name - constant.language.js + punctuation.separator.key-value + + + match + (?x) + !(?!=)| # logical-not right-to-left right + && | # logical-and left-to-right both + \|\| # logical-or left-to-right both + + name + keyword.operator.logical.js + + + match + (?x) + ~ | # bitwise-not right-to-left right + << | # bitwise-shift left-to-right both + >>> | # bitwise-shift left-to-right both + >> | # bitwise-shift left-to-right both + & | # bitwise-and left-to-right both + \^ | # bitwise-xor left-to-right both + \| # bitwise-or left-to-right both + + name + keyword.operator.bitwise.js + + + match + (?x) + < | # relational left-to-right both + > | # relational left-to-right both + <= | # relational left-to-right both + >= # relational left-to-right both + + name + keyword.operator.relational.js + + + match + (?x) + === | # equality left-to-right both + !== | # equality left-to-right both + == | # equality left-to-right both + != # equality left-to-right both + + name + keyword.operator.comparison.js + + + match + (?x) + %= | # assignment right-to-left both + &= | # assignment right-to-left both + \*= | # assignment right-to-left both + \+= | # assignment right-to-left both + -= | # assignment right-to-left both + /= | # assignment right-to-left both + \^= | # assignment right-to-left both + \|= | # assignment right-to-left both + <<= | # assignment right-to-left both + >>= | # assignment right-to-left both + >>>= # assignment right-to-left both + + name + keyword.operator.assignment.augmented.js + + + match + (?x) + = # assignment right-to-left both + + name + keyword.operator.assignment.js + + + match + (?x) + -- | # decrement n/a right-or-left + \+\+ | # increment n/a right-or-left + / | # division left-to-right both + % | # modulus left-to-right both + \* | # multiplication left-to-right both + \+ | # addition left-to-right both + - # subtraction left-to-right both + + name + keyword.operator.arithmetic.js - core-number + literal-labels + + patterns + + + captures + + 2 + + name + punctuation.separator.key-value.js + + + match + (?<=['"])(\s*)(:) + + + captures + + 1 + + name + string.unquoted.label.js + + 2 + + name + punctuation.separator.key-value.js + + + match + (?<!\?|\? |case )([_$a-zA-Z][_$\w]*)\s*(:) + name + constant.other.object.key.js + + + + literal-number patterns @@ -571,7 +751,7 @@ - core-punctuation + literal-punctuation patterns @@ -619,7 +799,7 @@ - core-regex + literal-regex patterns @@ -644,7 +824,7 @@ contentName string.regexp.js end - ((/([igm]*)))|$ + ((/([igm]*)))|(?=</\s*script\s*>\s*\n)|(?<=[^\\]\n) endCaptures 1 @@ -665,6 +845,18 @@ patterns + + match + \\\n + name + constant.character.escape.newline.js + + + match + \n + name + invalid.illegal.newline.js + match \\. @@ -675,7 +867,7 @@ - core-string + literal-string patterns @@ -743,6 +935,57 @@ + literal-variable + + patterns + + + match + (?<!\.)[_$a-zA-Z][_$\w]*\s*(?=[\[\.]) + name + variable.other.object.js + + + captures + + 0 + + name + meta.property-name.js + + 1 + + name + variable.other.object.js + + + match + ([_$a-zA-Z][_$\w]*)\s*(?=[\[\.]) + name + meta.property.js + + + captures + + 0 + + name + variable.other.property.js + + + match + (?<=[\.\]])\s*[_$a-zA-Z][_$\w]* + name + meta.property.js + + + match + [_$a-zA-Z][_$\w]* + name + variable.other.readwrite.js + + + special patterns @@ -984,7 +1227,7 @@ match - ( )( )?( )?( )?( )?( )?( )?( )?( )?( )?( )? + ( )( )?( )?( )?( )?( )?( )?( )?( )?( )?( )? captures @@ -1076,9 +1319,9 @@ match - (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b + (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|n(ext|ame(space(s|URI)|Prop))|c(haracterSet|o(ntrollers|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|X(MLDocument|SLDocument)|M(IN_VALUE|AX_VALUE)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|SQRT(1_2|2)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|NEGATIVE_INFINITY|u(ser(Profile|Language|Agent)|niqueID|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(tocol|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|P(I|OSITIVE_INFINITY)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|rity|bove|Linkcolor)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image))|L(N(10|2)|OG(10E|2E)))\b name - support.constant.js + support.variable.property.js match