File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ test('constants are not correctly loaded', () => {
79
79
} )
80
80
81
81
test ( 'operator syntax type error' , ( ) => {
82
- const code = 'const num = 3; \nnum++; \nnum--; \nnum += 1;'
82
+ const code = 'const num = 3; \nnum++; \nnum--; \nnum += 1; \n5 + num |2; '
83
83
84
84
setSession ( Chapter . SOURCE_1 , defaultVariant , defaultExternal , code )
85
85
@@ -91,6 +91,15 @@ test('operator syntax type error', () => {
91
91
92
92
const token3 = session . getTokenAt ( 3 , 5 )
93
93
expect ( expectedBool ( token3 , CATEGORY . forbidden ) ) . toBe ( true )
94
+
95
+ const token4 = session . getTokenAt ( 4 , 1 )
96
+ expect ( expectedBool ( token4 , CATEGORY . number ) ) . toBe ( true )
97
+
98
+ const token5 = session . getTokenAt ( 4 , 9 )
99
+ expect ( expectedBool ( token5 , CATEGORY . forbidden ) ) . toBe ( true )
100
+
101
+ const token6 = session . getTokenAt ( 4 , 10 )
102
+ expect ( expectedBool ( token6 , CATEGORY . number ) ) . toBe ( true )
94
103
} )
95
104
96
105
test ( 'forbidden keywords' , ( ) => {
Original file line number Diff line number Diff line change @@ -113,9 +113,9 @@ export function HighlightRulesSelector(
113
113
const VariantForbiddenRegexSelector = ( ) => {
114
114
if ( variant === Variant . TYPED ) {
115
115
// Removes the part of the regex that highlights singular |, since Typed variant uses union types
116
- return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | [ ^ & ] * & [ ^ & ] /
116
+ return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | (?< ! & ) & (? ! & ) /
117
117
}
118
- return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | [ ^ & ] * & [ ^ & ] | [ ^ \| ] * \| [ ^ \| ] /
118
+ return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | (?< ! & ) & (? ! & ) | (?< ! \| ) \| (? ! \| ) /
119
119
}
120
120
121
121
// @ts -ignore
You can’t perform that action at this time.
0 commit comments