File tree Expand file tree Collapse file tree 1 file changed +19
-21
lines changed Expand file tree Collapse file tree 1 file changed +19
-21
lines changed Original file line number Diff line number Diff line change 11import { toArray } from '../util/iterables.js' ;
2- import { insertBefore } from '../util/language-util.js' ;
32import clike from './clike.js' ;
43
54/** @type {import('../types.d.ts').LanguageProto<'squirrel'> } */
65export default {
76 id : 'squirrel' ,
87 base : clike ,
98 grammar ( { base } ) {
10- insertBefore ( base , 'string' , {
11- 'char' : {
12- pattern : / ( ^ | [ ^ \\ " ' ] ) ' (?: [ ^ \\ ' ] | \\ (?: [ x u U ] [ 0 - 9 a - f A - F ] { 0 , 8 } | [ \s \S ] ) ) ' / ,
13- lookbehind : true ,
14- greedy : true ,
15- } ,
16- } ) ;
17-
18- insertBefore ( base , 'operator' , {
19- 'attribute-punctuation' : {
20- pattern : / < \/ | \/ > / ,
21- alias : 'important' ,
22- } ,
23- 'lambda' : {
24- pattern : / @ (? = \( ) / ,
25- alias : 'operator' ,
26- } ,
27- } ) ;
28-
299 return {
3010 'comment' : [
31- ...toArray ( base . comment ) ,
11+ ...toArray ( /** @type { import('../types.d.ts').GrammarTokens } */ ( base ) . comment ) ,
3212 {
3313 pattern : / # .* / ,
3414 greedy : true ,
@@ -53,6 +33,24 @@ export default {
5333 'number' : / \b (?: 0 x [ 0 - 9 a - f A - F ] + | \d + (?: \. (?: \d + | [ e E ] [ + - ] ? \d + ) ) ? ) \b / ,
5434 'operator' : / \+ \+ | - - | < = > | < [ - < ] | > > > ? | & & ? | \| \| ? | [ - + * / % ! = < > ] = ? | [ ~ ^ ] | : : ? / ,
5535 'punctuation' : / [ ( ) { } \[ \] , ; . ] / ,
36+ $insert : {
37+ 'char' : {
38+ $before : 'string' ,
39+ pattern : / ( ^ | [ ^ \\ " ' ] ) ' (?: [ ^ \\ ' ] | \\ (?: [ x u U ] [ 0 - 9 a - f A - F ] { 0 , 8 } | [ \s \S ] ) ) ' / ,
40+ lookbehind : true ,
41+ greedy : true ,
42+ } ,
43+ 'attribute-punctuation' : {
44+ $before : 'operator' ,
45+ pattern : / < \/ | \/ > / ,
46+ alias : 'important' ,
47+ } ,
48+ 'lambda' : {
49+ $before : 'operator' ,
50+ pattern : / @ (? = \( ) / ,
51+ alias : 'operator' ,
52+ } ,
53+ } ,
5654 } ;
5755 } ,
5856} ;
You can’t perform that action at this time.
0 commit comments