Fix the type tokenization of instace of

Fixes #591
This commit is contained in:
Sheetal Nandi 2018-04-04 11:46:40 -07:00
Родитель 24b8d8d8b7
Коммит c4d834c232
5 изменённых файлов: 60 добавлений и 6 удалений

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

@ -1132,7 +1132,7 @@ repository:
begin: '{{startOfIdentifier}}(new){{endOfIdentifier}}'
beginCaptures:
'1': { name: keyword.operator.new.ts }
end: (?<=\))|(?=[;),}\]:]|$|({{startOfIdentifier}}new{{endOfIdentifier}})|({{startOfIdentifier}}function((\s+{{identifier}})|(\s*[\(]))))
end: (?<=\))|(?=[;),}\]:]|\|\||\&\&|$|({{startOfIdentifier}}new{{endOfIdentifier}})|({{startOfIdentifier}}function((\s+{{identifier}})|(\s*[\(]))))
patterns:
- include: '#paren-expression'
- include: '#class-declaration'
@ -1142,7 +1142,7 @@ repository:
begin: '{{startOfIdentifier}}(instanceof){{endOfIdentifier}}'
beginCaptures:
'1': { name: keyword.operator.expression.instanceof.ts }
end: (?<=\))|(?=[;),}\]:]|$|({{startOfIdentifier}}function((\s+{{identifier}})|(\s*[\(]))))
end: (?<=\))|(?=[;),}\]:]|\|\||\&\&|$|({{startOfIdentifier}}function((\s+{{identifier}})|(\s*[\(]))))
patterns:
- include: '#type'

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

@ -3555,7 +3555,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\))|(?=[;),}\]:]|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<string>(?&lt;=\))|(?=[;),}\]:]|\|\||\&amp;\&amp;|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<key>patterns</key>
<array>
<dict>
@ -3585,7 +3585,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\))|(?=[;),}\]:]|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<string>(?&lt;=\))|(?=[;),}\]:]|\|\||\&amp;\&amp;|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<key>patterns</key>
<array>
<dict>

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

@ -3559,7 +3559,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\))|(?=[;),}\]:]|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<string>(?&lt;=\))|(?=[;),}\]:]|\|\||\&amp;\&amp;|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<key>patterns</key>
<array>
<dict>
@ -3589,7 +3589,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\))|(?=[;),}\]:]|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<string>(?&lt;=\))|(?=[;),}\]:]|\|\||\&amp;\&amp;|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))</string>
<key>patterns</key>
<array>
<dict>

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

@ -0,0 +1,52 @@
original file
-----------------------------------
if (a instanceof B || c instanceof D) {
}
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>if (a instanceof B || c instanceof D) {
^^
source.ts keyword.control.conditional.ts
^
source.ts
^
source.ts meta.brace.round.ts
^
source.ts variable.other.readwrite.ts
^
source.ts
^^^^^^^^^^
source.ts keyword.operator.expression.instanceof.ts
^
source.ts
^
source.ts entity.name.type.ts
^
source.ts
^^
source.ts keyword.operator.logical.ts
^
source.ts
^
source.ts variable.other.readwrite.ts
^
source.ts
^^^^^^^^^^
source.ts keyword.operator.expression.instanceof.ts
^
source.ts
^
source.ts entity.name.type.ts
^
source.ts meta.brace.round.ts
^
source.ts
^
source.ts meta.block.ts punctuation.definition.block.ts
^^
source.ts meta.block.ts
>}
^
source.ts meta.block.ts punctuation.definition.block.ts

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

@ -0,0 +1,2 @@
if (a instanceof B || c instanceof D) {
}