1
1
2
2
NAME [a -zA -Z_ ][a -zA -Z0 -9_- ]*
3
+ BR \r\n | \n | \r
3
4
4
5
%s indented trail rules
5
6
%x code start_condition options conditions action
@@ -20,32 +21,32 @@ NAME [a-zA-Z_][a-zA-Z0-9_-]*
20
21
<conditions >" ," return ' ,'
21
22
<conditions >" *" return ' *'
22
23
23
- <rules >\n + /* */
24
+ <rules >{ BR } + /* */
24
25
<rules >\s + this .begin(' indented' )
25
26
<rules >" %%" this .begin(' code' ); return ' %%'
26
27
<rules >[a -zA -Z0 -9_ ]+ return ' CHARACTER_LIT'
27
28
28
29
<options >{NAME } yy.options[yytext] = true
29
- <options >\n + this .begin(' INITIAL' )
30
- <options >\s + \n + this .begin(' INITIAL' )
30
+ <options >{ BR } + this .begin(' INITIAL' )
31
+ <options >\s + { BR } + this .begin(' INITIAL' )
31
32
<options >\s + /* empty */
32
33
33
34
<start_condition >{NAME } return ' START_COND'
34
- <start_condition >\n + this .begin(' INITIAL' )
35
- <start_condition >\s + \n + this .begin(' INITIAL' )
35
+ <start_condition >{ BR } + this .begin(' INITIAL' )
36
+ <start_condition >\s + { BR } + this .begin(' INITIAL' )
36
37
<start_condition >\s + /* empty */
37
38
38
- <trail >. * \n + this .begin(' rules' )
39
+ <trail >. * { BR } + this .begin(' rules' )
39
40
40
41
<indented >" {" yy.depth = 0; this.begin('action'); return '{'
41
- <indented>"%{"(.|\n )*?"%}" this.begin(' trail' ); yytext = yytext.substr(2, yytext.length-4);return ' ACTION'
42
- "%{"(.|\n )*?"%}" yytext = yytext.substr(2, yytext.length-4); return ' ACTION'
42
+ <indented>"%{"(.|{BR} )*?"%}" this.begin(' trail' ); yytext = yytext.substr(2, yytext.length-4);return ' ACTION'
43
+ "%{"(.|{BR} )*?"%}" yytext = yytext.substr(2, yytext.length-4); return ' ACTION'
43
44
<indented>.+ this.begin(' rules' ); return ' ACTION'
44
45
45
46
"/*"(.|\n |\r )*?"*/" /* ignore */
46
47
"//".* /* ignore */
47
48
48
- \n + /* */
49
+ {BR}+ /* */
49
50
\s + /* */
50
51
{NAME} return ' NAME'
51
52
\" ("\\\\ "|' \" '|[^" ])*\" yytext = yytext.replace(/\\ " /g,' "' );return ' STRING_LIT'
@@ -81,7 +82,7 @@ NAME [a-zA-Z_][a-zA-Z0-9_-]*
81
82
. /* ignore bad characters */
82
83
<*><<EOF>> return ' EOF'
83
84
84
- <code>(.|\n )+ return ' CODE'
85
+ <code>(.|{BR})+ return ' CODE'
85
86
86
87
%%
87
88
0 commit comments