Documented the grammar.
Showing
1 changed file
with
14 additions
and
5 deletions
... | @@ -341,12 +341,14 @@ else return ELSE; | ... | @@ -341,12 +341,14 @@ else return ELSE; |
341 | anyof return ANYOF; | 341 | anyof return ANYOF; |
342 | allof return ALLOF; | 342 | allof return ALLOF; |
343 | not return NOT; | 343 | not return NOT; |
344 | /* Other tokens */ | 344 | /* Identifiers */ |
345 | {IDENT} { ident (yytext); return IDENT; } | 345 | {IDENT} { ident (yytext); return IDENT; } |
346 | :{IDENT} { ident (yytext + 1); return TAG; } | 346 | :{IDENT} { ident (yytext + 1); return TAG; } |
347 | /* Numbers */ | ||
347 | 0[0-7]*{SIZESUF}* { return number (); } | 348 | 0[0-7]*{SIZESUF}* { return number (); } |
348 | 0x[0-9a-fA-F][0-9a-fA-F]+{SIZESUF}* { return number (); } | 349 | 0x[0-9a-fA-F][0-9a-fA-F]+{SIZESUF}* { return number (); } |
349 | [1-9][0-9]*{SIZESUF}* { return number (); } | 350 | [1-9][0-9]*{SIZESUF}* { return number (); } |
351 | /* Quoted strings */ | ||
350 | \"[^\\"\n]*\" { return string (); } | 352 | \"[^\\"\n]*\" { return string (); } |
351 | \"[^\\"\n]*\\. { BEGIN(STR); | 353 | \"[^\\"\n]*\\. { BEGIN(STR); |
352 | multiline_begin (); | 354 | multiline_begin (); |
... | @@ -356,12 +358,18 @@ not return NOT; | ... | @@ -356,12 +358,18 @@ not return NOT; |
356 | multiline_add (NULL); | 358 | multiline_add (NULL); |
357 | multiline_finish (); | 359 | multiline_finish (); |
358 | return STRING; } | 360 | return STRING; } |
359 | text:-?[ \t]*#.*\n { BEGIN(ML); multiline_begin (); } | 361 | /* Multiline strings */ |
360 | text:-?[ \t]*\n { BEGIN(ML); multiline_begin (); } | 362 | text:-?[ \t]*#.*\n { BEGIN(ML); multiline_begin (); sieve_line_num++; } |
361 | text:-?\\?{IDENT}[ \t]*#.*\n { BEGIN(ML); multiline_begin (); } | 363 | text:-?[ \t]*\n { BEGIN(ML); multiline_begin (); sieve_line_num++; } |
362 | text:-?\\?{IDENT}[ \t]*\n { BEGIN(ML); multiline_begin (); } | 364 | text:-?\\?{IDENT}[ \t]*#.*\n { BEGIN(ML); multiline_begin (); |
365 | sieve_line_num++; } | ||
366 | text:-?\\?{IDENT}[ \t]*\n { BEGIN(ML); multiline_begin (); | ||
367 | sieve_line_num++; } | ||
363 | <ML>#[ \t]*include.*\n { if (multiline_delimiter[0] == '\\') | 368 | <ML>#[ \t]*include.*\n { if (multiline_delimiter[0] == '\\') |
369 | { | ||
370 | sieve_line_num++; | ||
364 | multiline_add (NULL); | 371 | multiline_add (NULL); |
372 | } | ||
365 | else | 373 | else |
366 | sieve_include (); } | 374 | sieve_include (); } |
367 | <ML>.*\n { char *p = multiline_strip_tabs (yytext); | 375 | <ML>.*\n { char *p = multiline_strip_tabs (yytext); |
... | @@ -379,6 +387,7 @@ text:-?\\?{IDENT}[ \t]*\n { BEGIN(ML); multiline_begin (); } | ... | @@ -379,6 +387,7 @@ text:-?\\?{IDENT}[ \t]*\n { BEGIN(ML); multiline_begin (); } |
379 | } | 387 | } |
380 | multiline_add (NULL); } | 388 | multiline_add (NULL); } |
381 | {WS} ; | 389 | {WS} ; |
390 | /* Other tokens */ | ||
382 | \n { sieve_line_num++; } | 391 | \n { sieve_line_num++; } |
383 | . return yytext[0]; | 392 | . return yytext[0]; |
384 | 393 | ... | ... |
-
Please register or sign in to post a comment