Match template strings while matching strings

Fixes #661
This commit is contained in:
Sheetal Nandi 2018-08-30 09:07:23 -07:00
Родитель 67d50d27f0
Коммит a9ad6eb7b4
5 изменённых файлов: 232 добавлений и 43 удалений

Просмотреть файл

@ -12,7 +12,7 @@ variables:
propertyAccessPreIdentifier: \??\.\s*
identifier: '[_$[:alpha:]][_$[:alnum:]]*'
constantIdentifier: '[[:upper:]][_$[:digit:][:upper:]]*'
quotedStrings: (\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")
quotedStrings: (\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)
nonIdentifierPropertyName: '{{quotedStrings}}|(\[([^\[\]]|\[[^\[\]]*\])+\])'
label: ({{identifier}})\s*(:)
hexNumber: \b(?<!\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\b(?!\$)
@ -136,7 +136,6 @@ repository:
statements:
patterns:
- include: '#string'
- include: '#template'
- include: '#comment'
- include: '#declaration'
- include: '#control-statement'
@ -212,7 +211,6 @@ repository:
patterns:
- include: '#string'
- include: '#regex'
- include: '#template'
- include: '#comment'
- include: '#function-expression'
- include: '#class-expression'
@ -2321,6 +2319,7 @@ repository:
patterns:
- include: '#qstring-single'
- include: '#qstring-double'
- include: '#template'
qstring-double:
name: string.quoted.double.ts

Просмотреть файл

@ -47,10 +47,6 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#template</string>
</dict>
<dict>
<key>include</key>
<string>#comment</string>
@ -299,10 +295,6 @@
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#template</string>
</dict>
<dict>
<key>include</key>
<string>#comment</string>
@ -1023,7 +1015,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(?=,|\})</string>
<key>patterns</key>
@ -1075,7 +1067,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(?=,|\})</string>
<key>patterns</key>
@ -1120,7 +1112,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(:)</string>
<key>endCaptures</key>
@ -1652,7 +1644,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(?=,|\})</string>
<key>patterns</key>
@ -1821,7 +1813,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -1840,7 +1832,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?&lt;=\})</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?&lt;=\})</string>
<key>patterns</key>
<array>
<dict>
@ -2263,7 +2255,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -2322,7 +2314,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -2364,7 +2356,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -2407,7 +2399,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\&lt;])</string>
<key>end</key>
<string>(?=\(|\&lt;)</string>
<key>patterns</key>
@ -3165,7 +3157,7 @@
</dict>
<dict>
<key>begin</key>
<string>(?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\])))</string>
<string>(?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\])))</string>
<key>end</key>
<string>(?=,|\}|$)</string>
<key>patterns</key>
@ -6841,6 +6833,10 @@
<key>include</key>
<string>#qstring-double</string>
</dict>
<dict>
<key>include</key>
<string>#template</string>
</dict>
</array>
</dict>
<key>qstring-double</key>
@ -7501,7 +7497,7 @@
<key>name</key>
<string>comment.line.triple-slash.directive.ts</string>
<key>begin</key>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/&gt;\s*$)</string>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)))+\s*/&gt;\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>

Просмотреть файл

@ -47,10 +47,6 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#template</string>
</dict>
<dict>
<key>include</key>
<string>#comment</string>
@ -303,10 +299,6 @@
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#template</string>
</dict>
<dict>
<key>include</key>
<string>#comment</string>
@ -1027,7 +1019,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(?=,|\})</string>
<key>patterns</key>
@ -1079,7 +1071,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(?=,|\})</string>
<key>patterns</key>
@ -1124,7 +1116,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(:)</string>
<key>endCaptures</key>
@ -1656,7 +1648,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(:))</string>
<key>end</key>
<string>(?=,|\})</string>
<key>patterns</key>
@ -1825,7 +1817,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -1844,7 +1836,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?&lt;=\})</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\?\s*)?(=|:|;|,|$))))|(?&lt;=\})</string>
<key>patterns</key>
<array>
<dict>
@ -2267,7 +2259,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -2326,7 +2318,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -2368,7 +2360,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??))\s*[\(\&lt;])</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -2411,7 +2403,7 @@
(?:\b[0-9][0-9_]*(\.)\B)| # 1.
(?:\B(\.)[0-9][0-9_]*\b)| # .1
(?:\b[0-9][0-9_]*\b(?!\.)) # 1
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\&lt;])</string>
)(?!\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\]))\s*(\??)\s*[\(\&lt;])</string>
<key>end</key>
<string>(?=\(|\&lt;)</string>
<key>patterns</key>
@ -3169,7 +3161,7 @@
</dict>
<dict>
<key>begin</key>
<string>(?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\[([^\[\]]|\[[^\[\]]*\])+\])))</string>
<string>(?=((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)|(\[([^\[\]]|\[[^\[\]]*\])+\])))</string>
<key>end</key>
<string>(?=,|\}|$)</string>
<key>patterns</key>
@ -6787,6 +6779,10 @@
<key>include</key>
<string>#qstring-double</string>
</dict>
<dict>
<key>include</key>
<string>#template</string>
</dict>
</array>
</dict>
<key>qstring-double</key>
@ -7447,7 +7443,7 @@
<key>name</key>
<string>comment.line.triple-slash.directive.tsx</string>
<key>begin</key>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/&gt;\s*$)</string>
<string>^(///)\s*(?=&lt;(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\'([^\'\\]|\\\'|\\)*\')|(\"([^\"\\]|\\\"|\\)*\")|(\`([^\`\\]|\\\`|\\)*\`)))+\s*/&gt;\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>

Просмотреть файл

@ -0,0 +1,184 @@
original file
-----------------------------------
// breaks when '{' start in a new line behind a '('
const foo = () => (
{
num: 1,
foo: 'foo',
bar: `bar`,
// '=' break all following highlighting
baz: `baz=${123}`,
}
);
class TestColor extends Foo {
public init() {}
}
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>// breaks when '{' start in a new line behind a '('
^^
source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts comment.line.double-slash.ts
>const foo = () => (
^^^^^
source.ts meta.var.expr.ts storage.type.ts
^
source.ts meta.var.expr.ts
^^^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts
^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts
^
source.ts meta.var.expr.ts keyword.operator.assignment.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.brace.round.ts
> {
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts
> num: 1,
^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts
> foo: 'foo',
^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.quoted.single.ts punctuation.definition.string.begin.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.quoted.single.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.quoted.single.ts punctuation.definition.string.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts
> bar: `bar`,
^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.begin.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts
> // '=' break all following highlighting
^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.whitespace.comment.leading.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts comment.line.double-slash.ts punctuation.definition.comment.ts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts comment.line.double-slash.ts
> baz: `baz=${123}`,
^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.begin.ts
^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts constant.numeric.decimal.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.template.ts punctuation.definition.string.template.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts
> }
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts
>);
^
source.ts meta.var.expr.ts meta.arrow.ts meta.brace.round.ts
^
source.ts punctuation.terminator.statement.ts
>
^
source.ts
>class TestColor extends Foo {
^^^^^
source.ts meta.class.ts storage.type.class.ts
^
source.ts meta.class.ts
^^^^^^^^^
source.ts meta.class.ts entity.name.type.class.ts
^
source.ts meta.class.ts
^^^^^^^
source.ts meta.class.ts storage.modifier.ts
^
source.ts meta.class.ts
^^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.definition.block.ts
> public init() {}
^^
source.ts meta.class.ts
^^^^^^
source.ts meta.class.ts meta.method.declaration.ts storage.modifier.ts
^
source.ts meta.class.ts meta.method.declaration.ts
^^^^
source.ts meta.class.ts meta.method.declaration.ts meta.definition.method.ts entity.name.function.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.class.ts meta.method.declaration.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts
>}
^
source.ts meta.class.ts punctuation.definition.block.ts

14
tests/cases/Issue661.ts Normal file
Просмотреть файл

@ -0,0 +1,14 @@
// breaks when '{' start in a new line behind a '('
const foo = () => (
{
num: 1,
foo: 'foo',
bar: `bar`,
// '=' break all following highlighting
baz: `baz=${123}`,
}
);
class TestColor extends Foo {
public init() {}
}