Adding a safe expression list for expressions in ternary operator.
This commit is contained in:
Родитель
aefa631571
Коммит
79bf69c3f4
|
@ -26,17 +26,44 @@ repository:
|
|||
'1': { name: variable.ts }
|
||||
end: (?=$|[;,])
|
||||
patterns:
|
||||
- include: '#ternary-operator'
|
||||
- include: '#ternary-expression'
|
||||
- include: '#type-annotation'
|
||||
- include: '#string'
|
||||
- include: '#comment'
|
||||
- include: '#expression'
|
||||
|
||||
ternary-expression:
|
||||
begin: (?=\?)
|
||||
end: (?=$|[;,])
|
||||
patterns:
|
||||
- include: '#ternary-operator'
|
||||
- include: '#ternary-expression-type'
|
||||
|
||||
ternary-operator:
|
||||
begin: (\?)
|
||||
end: (:)
|
||||
patterns:
|
||||
- include: '#expression'
|
||||
- include: '#ternary-expression-type'
|
||||
|
||||
ternary-expression-type:
|
||||
name: meta.expression.ts
|
||||
patterns:
|
||||
- include: '#string'
|
||||
- include: '#regex'
|
||||
- include: '#template'
|
||||
- include: '#comment'
|
||||
- include: '#literal'
|
||||
- include: '#paren-expression'
|
||||
- include: '#ternary-expression'
|
||||
- include: '#import-operator'
|
||||
- include: '#expression-operator'
|
||||
- include: '#imply-operator'
|
||||
- include: '#relational-operator'
|
||||
- include: '#arithmetic-operator'
|
||||
- include: '#logic-operator'
|
||||
- include: '#assignment-operator'
|
||||
- include: '#type-primitive'
|
||||
- include: '#function-call'
|
||||
|
||||
control-statement:
|
||||
name: keyword.control.ts
|
||||
|
|
|
@ -1448,6 +1448,96 @@
|
|||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ternary-expression</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?=\?)</string>
|
||||
<key>end</key>
|
||||
<string>(?=$|[;,])</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-expression-type</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ternary-expression-type</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.expression.ts</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#string</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#regex</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#template</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#comment</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#literal</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#paren-expression</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-expression</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#import-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#imply-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#relational-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#arithmetic-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#logic-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#assignment-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#type-primitive</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#function-call</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ternary-operator</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
|
@ -1458,7 +1548,7 @@
|
|||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression</string>
|
||||
<string>#ternary-expression-type</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
|
@ -1855,7 +1945,7 @@
|
|||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-operator</string>
|
||||
<string>#ternary-expression</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
|
|
|
@ -28,17 +28,44 @@ repository:
|
|||
'1': { name: variable.tsx }
|
||||
end: (?=$|[;,])
|
||||
patterns:
|
||||
- include: '#ternary-operator'
|
||||
- include: '#ternary-expression'
|
||||
- include: '#type-annotation'
|
||||
- include: '#string'
|
||||
- include: '#comment'
|
||||
- include: '#expression'
|
||||
|
||||
ternary-expression:
|
||||
begin: (?=\?)
|
||||
end: (?=$|[;,])
|
||||
patterns:
|
||||
- include: '#ternary-operator'
|
||||
- include: '#ternary-expression-type'
|
||||
|
||||
ternary-operator:
|
||||
begin: (\?)
|
||||
end: (:)
|
||||
patterns:
|
||||
- include: '#expression'
|
||||
- include: '#ternary-expression-type'
|
||||
|
||||
ternary-expression-type:
|
||||
name: meta.expression.tsx
|
||||
patterns:
|
||||
- include: '#string'
|
||||
- include: '#regex'
|
||||
- include: '#template'
|
||||
- include: '#comment'
|
||||
- include: '#literal'
|
||||
- include: '#paren-expression'
|
||||
- include: '#ternary-expression'
|
||||
- include: '#import-operator'
|
||||
- include: '#expression-operator'
|
||||
- include: '#imply-operator'
|
||||
- include: '#relational-operator'
|
||||
- include: '#arithmetic-operator'
|
||||
- include: '#logic-operator'
|
||||
- include: '#assignment-operator'
|
||||
- include: '#type-primitive'
|
||||
- include: '#function-call'
|
||||
|
||||
control-statement:
|
||||
name: keyword.control.tsx
|
||||
|
|
|
@ -1814,6 +1814,96 @@
|
|||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ternary-expression</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?=\?)</string>
|
||||
<key>end</key>
|
||||
<string>(?=$|[;,])</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-expression-type</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ternary-expression-type</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.expression.tsx</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#string</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#regex</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#template</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#comment</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#literal</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#paren-expression</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-expression</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#import-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#imply-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#relational-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#arithmetic-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#logic-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#assignment-operator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#type-primitive</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#function-call</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>ternary-operator</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
|
@ -1824,7 +1914,7 @@
|
|||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression</string>
|
||||
<string>#ternary-expression-type</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
|
@ -2221,7 +2311,7 @@
|
|||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#ternary-operator</string>
|
||||
<string>#ternary-expression</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
|
|
Загрузка…
Ссылка в новой задаче