Skip to content

Commit 6976997

Browse files
committed
Solving issue 110: allowing exponential numbers
1 parent 014ea4c commit 6976997

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ repository:
631631

632632
numeric-literal:
633633
name: constant.numeric.ts
634-
match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b
634+
match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|(([0-9]+(\.[0-9]+)?))(e[0-9]+(\.[0-9]+)?)?)\b
635635

636636
boolean-literal:
637637
name: constant.language.boolean.ts

TypeScript.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@
869869
<key>numeric-literal</key>
870870
<dict>
871871
<key>match</key>
872-
<string>\b(?&lt;=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b</string>
872+
<string>\b(?&lt;=[^$])((0(x|X)[0-9a-fA-F]+)|(([0-9]+(\.[0-9]+)?))(e[0-9]+(\.[0-9]+)?)?)\b</string>
873873
<key>name</key>
874874
<string>constant.numeric.ts</string>
875875
</dict>

TypeScriptReact.YAML-tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ repository:
619619

620620
numeric-literal:
621621
name: constant.numeric.tsx
622-
match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b
622+
match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|(([0-9]+(\.[0-9]+)?))(e[0-9]+(\.[0-9]+)?)?)\b
623623

624624
boolean-literal:
625625
name: constant.language.boolean.tsx

TypeScriptReact.tmLanguage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@
12351235
<key>numeric-literal</key>
12361236
<dict>
12371237
<key>match</key>
1238-
<string>\b(?&lt;=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b</string>
1238+
<string>\b(?&lt;=[^$])((0(x|X)[0-9a-fA-F]+)|(([0-9]+(\.[0-9]+)?))(e[0-9]+(\.[0-9]+)?)?)\b</string>
12391239
<key>name</key>
12401240
<string>constant.numeric.tsx</string>
12411241
</dict>

tests/baselines/Issue110.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[1, 15]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts constant.numeric.ts
2+
[2, 15]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts constant.numeric.ts
3+
[3, 15]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts constant.numeric.ts
4+
[4, 15]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts constant.numeric.ts
5+
[5, 15]: source.ts meta.var.expr.ts meta.var-single-variable.expr.ts constant.numeric.ts
6+
[8, 1]: source.ts comment.block.ts

tests/cases/Issue110.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
let number1 = ^^0x100
2+
let number2 = ^^14e15
3+
let number3 = ^^10.42e41.5
4+
let number4 = ^^4
5+
let number5 = ^^51.4
6+
7+
/*
8+
^^
9+
Testing comments
10+
*/

0 commit comments

Comments
 (0)