Skip to content

Commit

Permalink
Add +\- to the list to end the new expression
Browse files Browse the repository at this point in the history
Fixes #673
  • Loading branch information
sheetalkamat committed Oct 12, 2018
1 parent 6e8a383 commit a34cb11
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,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'
Expand Down
2 changes: 1 addition & 1 deletion TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -4472,7 +4472,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\))|(?=[;),}\]:]|\|\||\&amp;\&amp;|$|((?&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>
Expand Down
2 changes: 1 addition & 1 deletion TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -4476,7 +4476,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\))|(?=[;),}\]:]|\|\||\&amp;\&amp;|$|((?&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>
Expand Down
76 changes: 76 additions & 0 deletions tests/baselines/Issue673.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
original file
-----------------------------------
+new Date - 1 < 2;
var abc = 'abc';
function abc2() { }
-----------------------------------

Grammar: TypeScript.tmLanguage
-----------------------------------
>+new Date - 1 < 2;
^
source.ts keyword.operator.arithmetic.ts
^^^
source.ts new.expr.ts keyword.operator.new.ts
^
source.ts new.expr.ts
^^^^
source.ts new.expr.ts entity.name.type.ts
^
source.ts new.expr.ts
^
source.ts keyword.operator.arithmetic.ts
^
source.ts
^
source.ts constant.numeric.decimal.ts
^
source.ts
^
source.ts keyword.operator.relational.ts
^
source.ts
^
source.ts constant.numeric.decimal.ts
^
source.ts punctuation.terminator.statement.ts
>var abc = 'abc';
^^^
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.readwrite.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
^
source.ts meta.var.expr.ts string.quoted.single.ts punctuation.definition.string.begin.ts
^^^
source.ts meta.var.expr.ts string.quoted.single.ts
^
source.ts meta.var.expr.ts string.quoted.single.ts punctuation.definition.string.end.ts
^
source.ts punctuation.terminator.statement.ts
>function abc2() { }
^^^^^^^^
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 punctuation.definition.parameters.end.ts
^
source.ts meta.function.ts
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
^
source.ts meta.function.ts meta.block.ts
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
3 changes: 3 additions & 0 deletions tests/cases/Issue673.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
+new Date - 1 < 2;
var abc = 'abc';
function abc2() { }

0 comments on commit a34cb11

Please sign in to comment.