diff --git a/ccmeta.leg b/ccmeta.leg index d04e0e7..8018d29 100644 --- a/ccmeta.leg +++ b/ccmeta.leg @@ -1972,22 +1972,6 @@ ids = i:id { listWith(i) } ( c:COMMA i:id { listAppend2(c, i) } )* { $$= listEnd() } -- = < Space* > { if (yyleng && $$) setComment($$, newComment(yytext)) } - -Space = Blank | Comment | EOL | Directive - | "__extension__" &{gnu} { icol += 13 } - -Blank = ( [\003-\010] | '\013' | '\f' | [\016-\037] | [\177-\377] | ' ' ) { ++icol } - | '\t' { icol= (icol + 8) & ~7 } - -EOL = ( "\r\n" | '\n' | '\r' ) { ++irow; icol= 0 } - -Comment = "/*" ( !"*/" (EOL | Any) )* "*/" - | "//" ( ![\n\r] Any )* EOL - -Directive = "#" (!EOL .)* - -Any = . { ++icol } ### @@ -2105,8 +2089,27 @@ _FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float1 #--------------------------------------------- Common rules ----------------------------------------------# -- = (blank | comment)* +- = (blank | comment)* &{lang == META} + | < Space* > &{lang == C} { if (yyleng && $$) setComment($$, newComment(yytext)) } + + +#| C rules +Space = Blank | Comment | EOL | Directive + | "__extension__" &{gnu} { icol += 13 } + +Blank = ( [\003-\010] | '\013' | '\f' | [\016-\037] | [\177-\377] | ' ' ) { ++icol } + | '\t' { icol= (icol + 8) & ~7 } + +EOL = ( "\r\n" | '\n' | '\r' ) { ++irow; icol= 0 } + +Comment = "/*" ( !"*/" (EOL | Any) )* "*/" + | "//" ( ![\n\r] Any )* EOL + +Directive = "#" (!EOL .)* + +Any = . { ++icol } +#| Meta rules blank = space | eol space = [ \t] eol = ( "\n""\r"*