Handle the "/" followed by "]" to ensure it not being treated as regex
Fixes #580
This commit is contained in:
Родитель
a7080b7f47
Коммит
b9f410d6cd
|
@ -1245,7 +1245,7 @@ repository:
|
|||
- name: keyword.operator.arithmetic.ts
|
||||
match: '%|\*|/|-|\+'
|
||||
# capture the arithmetic sign followed by variable or parenthesized expression so that it is not interpreted as regex
|
||||
- match: (?<=[_$[:alnum:])])\s*(/)(?![/*])
|
||||
- match: (?<=[_$[:alnum:])\]])\s*(/)(?![/*])
|
||||
captures:
|
||||
'1': { name: keyword.operator.arithmetic.ts }
|
||||
|
||||
|
@ -2033,7 +2033,7 @@ repository:
|
|||
- include: '#regexp'
|
||||
# Check if complete regexp syntax
|
||||
- name: string.regexp.ts
|
||||
begin: (?<![_$[:alnum:])])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))
|
||||
begin: (?<![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))
|
||||
beginCaptures:
|
||||
'0': {name: punctuation.definition.string.begin.ts}
|
||||
end: (/)([gimuy]*)
|
||||
|
|
|
@ -3868,7 +3868,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?<=[_$[:alnum:])])\s*(/)(?![/*])</string>
|
||||
<string>(?<=[_$[:alnum:])\]])\s*(/)(?![/*])</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -5738,7 +5738,7 @@
|
|||
<key>name</key>
|
||||
<string>string.regexp.ts</string>
|
||||
<key>begin</key>
|
||||
<string>(?<![_$[:alnum:])])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
|
||||
<string>(?<![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
|
|
|
@ -3814,7 +3814,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?<=[_$[:alnum:])])\s*(/)(?![/*])</string>
|
||||
<string>(?<=[_$[:alnum:])\]])\s*(/)(?![/*])</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -5684,7 +5684,7 @@
|
|||
<key>name</key>
|
||||
<string>string.regexp.tsx</string>
|
||||
<key>begin</key>
|
||||
<string>(?<![_$[:alnum:])])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
|
||||
<string>(?<![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
(a[0] / 2) / (2)
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>(a[0] / 2) / (2)
|
||||
^
|
||||
source.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts variable.other.readwrite.ts
|
||||
^
|
||||
source.ts meta.array.literal.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts meta.array.literal.ts constant.numeric.decimal.ts
|
||||
^
|
||||
source.ts meta.array.literal.ts meta.brace.square.ts
|
||||
^
|
||||
source.ts
|
||||
^
|
||||
source.ts keyword.operator.arithmetic.ts
|
||||
^
|
||||
source.ts
|
||||
^
|
||||
source.ts constant.numeric.decimal.ts
|
||||
^
|
||||
source.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts
|
||||
^
|
||||
source.ts keyword.operator.arithmetic.ts
|
||||
^
|
||||
source.ts
|
||||
^
|
||||
source.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts constant.numeric.decimal.ts
|
||||
^
|
||||
source.ts meta.brace.round.ts
|
|
@ -0,0 +1 @@
|
|||
(a[0] / 2) / (2)
|
Загрузка…
Ссылка в новой задаче