Fix in correctly detecting arrow type argument end with as =>

Fixes #692
This commit is contained in:
Sheetal Nandi 2018-12-04 11:11:41 -08:00
Родитель 91294ab634
Коммит 21ec2c292f
5 изменённых файлов: 277 добавлений и 9 удалений

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

@ -65,7 +65,7 @@ variables:
# Identifier start | matching braces | matching parenthesis | matching square brackets | matching strings
typeArgumentsStart: (((keyof|infer|typeof)\s+)|(({{identifier}}|{{matchingBraces}}|{{matchingParenthesis}}|{{matchingBrackets}}|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))
typeArgumentsInnerExpressionPart: '[^<>\(]|{{matchingParenthesis}}|(?<==)\>'
typeArguments: '<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}}|\<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}})*(?!=)\>)*(?!=)>'
typeArguments: '<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}}|\<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}})*(?<!=)\>)*(?<!=)>'
functionCallLookup: \s*(\?\.\s*)?({{typeArguments}}\s*)?\(
returnTypeOfArrow: \s*([^<>\(\)\{\}]|\<[^<>]+\>|\([^\(\)]+\)|\{[^\{\}]+\})+
arrowLookup: |-

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

@ -4401,9 +4401,9 @@
<key>function-call</key>
<dict>
<key>begin</key>
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)?\()</string>
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)?\()</string>
<key>end</key>
<string>(?&lt;=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)?\()</string>
<string>(?&lt;=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)?\()</string>
<key>patterns</key>
<array>
<dict>
@ -4412,7 +4412,7 @@
<key>begin</key>
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))</string>
<key>end</key>
<string>(?=\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)?\()</string>
<string>(?=\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)?\()</string>
<key>patterns</key>
<array>
<dict>
@ -7209,7 +7209,7 @@
<key>name</key>
<string>string.template.ts</string>
<key>begin</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)`)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)`)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>

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

@ -4405,9 +4405,9 @@
<key>function-call</key>
<dict>
<key>begin</key>
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)?\()</string>
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)?\()</string>
<key>end</key>
<string>(?&lt;=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)?\()</string>
<string>(?&lt;=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)?\()</string>
<key>patterns</key>
<array>
<dict>
@ -4416,7 +4416,7 @@
<key>begin</key>
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))</string>
<key>end</key>
<string>(?=\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)?\()</string>
<string>(?=\s*(\?\.\s*)?(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)?\()</string>
<key>patterns</key>
<array>
<dict>
@ -7155,7 +7155,7 @@
<key>name</key>
<string>string.template.tsx</string>
<key>begin</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;\s*)`)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(((keyof|infer|typeof)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\&lt;\&gt;\,\.\[]|=&gt;|&amp;(?!&amp;)|\|(?!\|)))))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?&lt;!=)\&gt;)*(?&lt;!=)&gt;\s*)`)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>

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

@ -0,0 +1,262 @@
original file
-----------------------------------
export function isInOpenInterval(start: number, end: number) {
return tersible(a => a > start && a < end, () => `(${start}...${end})`)
}
export function isInClosedInterval(start: number, end: number) {
return tersible(a => a >= start && a <= end, () => `[${start}...${end}]`)
}
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>export function isInOpenInterval(start: number, end: number) {
^^^^^^
source.ts meta.function.ts keyword.control.export.ts
^
source.ts meta.function.ts
^^^^^^^^
source.ts meta.function.ts storage.type.function.ts
^
source.ts meta.function.ts
^^^^^^^^^^^^^^^^
source.ts meta.function.ts meta.definition.function.ts entity.name.function.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^^^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts
^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.function.ts
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
> return tersible(a => a > start && a < end, () => `(${start}...${end})`)
^^
source.ts meta.function.ts meta.block.ts
^^^^^^
source.ts meta.function.ts meta.block.ts keyword.control.flow.ts
^
source.ts meta.function.ts meta.block.ts
^^^^^^^^
source.ts meta.function.ts meta.block.ts meta.function-call.ts entity.name.function.ts
^
source.ts meta.function.ts meta.block.ts meta.brace.round.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts variable.parameter.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^^
source.ts meta.function.ts meta.block.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts
^
source.ts meta.function.ts meta.block.ts keyword.operator.relational.ts
^
source.ts meta.function.ts meta.block.ts
^^^^^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts
^^
source.ts meta.function.ts meta.block.ts keyword.operator.logical.ts
^
source.ts meta.function.ts meta.block.ts
^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts
^
source.ts meta.function.ts meta.block.ts keyword.operator.relational.ts
^
source.ts meta.function.ts meta.block.ts
^^^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts punctuation.separator.comma.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^^
source.ts meta.function.ts meta.block.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts punctuation.definition.string.template.begin.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts
^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^^^
source.ts meta.function.ts meta.block.ts string.template.ts
^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts punctuation.definition.string.template.end.ts
^
source.ts meta.function.ts meta.block.ts meta.brace.round.ts
>}
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
>export function isInClosedInterval(start: number, end: number) {
^^^^^^
source.ts meta.function.ts keyword.control.export.ts
^
source.ts meta.function.ts
^^^^^^^^
source.ts meta.function.ts storage.type.function.ts
^
source.ts meta.function.ts
^^^^^^^^^^^^^^^^^^
source.ts meta.function.ts meta.definition.function.ts entity.name.function.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^^^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts
^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.function.ts
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
> return tersible(a => a >= start && a <= end, () => `[${start}...${end}]`)
^^
source.ts meta.function.ts meta.block.ts
^^^^^^
source.ts meta.function.ts meta.block.ts keyword.control.flow.ts
^
source.ts meta.function.ts meta.block.ts
^^^^^^^^
source.ts meta.function.ts meta.block.ts meta.function-call.ts entity.name.function.ts
^
source.ts meta.function.ts meta.block.ts meta.brace.round.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts variable.parameter.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^^
source.ts meta.function.ts meta.block.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts
^^
source.ts meta.function.ts meta.block.ts keyword.operator.relational.ts
^
source.ts meta.function.ts meta.block.ts
^^^^^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts
^^
source.ts meta.function.ts meta.block.ts keyword.operator.logical.ts
^
source.ts meta.function.ts meta.block.ts
^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts
^^
source.ts meta.function.ts meta.block.ts keyword.operator.relational.ts
^
source.ts meta.function.ts meta.block.ts
^^^
source.ts meta.function.ts meta.block.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts punctuation.separator.comma.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^^
source.ts meta.function.ts meta.block.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.function.ts meta.block.ts meta.arrow.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts punctuation.definition.string.template.begin.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts
^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^^^
source.ts meta.function.ts meta.block.ts string.template.ts
^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts
^
source.ts meta.function.ts meta.block.ts string.template.ts punctuation.definition.string.template.end.ts
^
source.ts meta.function.ts meta.block.ts meta.brace.round.ts
>}
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts

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

@ -0,0 +1,6 @@
export function isInOpenInterval(start: number, end: number) {
return tersible(a => a > start && a < end, () => `(${start}...${end})`)
}
export function isInClosedInterval(start: number, end: number) {
return tersible(a => a >= start && a <= end, () => `[${start}...${end}]`)
}