diff --git a/source/fscanner.l b/source/fscanner.l index 5de694b..fb78618 100644 --- a/source/fscanner.l +++ b/source/fscanner.l @@ -99,6 +99,12 @@ static int ident_start; /* begin of preceding identifier */ static void my_yymore(void); %} +%x IN_PREPROC WAS_ENDIF WAS_IDENTIFIER WAS_ESU IN_DQUOTE IN_SQUOTE COMMENT + +/* XXX: + * the {comment} pattern seems unnecesarry as the COMMENT state unputs a ' ', + * but i do not dare to touch it until we have tests + */ identifier [a-zA-Z_$][a-zA-Z_0-9$]* number \.?[0-9][.0-9a-fA-FlLuUxX]* comment "/*"([^*]*("*"+[^/])?)*"*/"|"//"[^\n]*\n @@ -109,17 +115,15 @@ class_definition class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{ function_definition {ws}*\(({wsnl}|{identifier}|{number}|[*&[\]=,.:])*\)([()]|{wsnl})*[:a-zA-Z_#{] function_call {ws}*\(([*&[\]=,.]|{identifier}|{number}|{wsnl})* -/* flex options: stack of start conditions, and don't use yywrap() */ %option stack %option noyywrap +/* unused */ +%option noyy_top_state %start SDL %a 4000 %o 7000 -/* exclusive start conditions. not available in AT&T lex -> use flex! */ -%x IN_PREPROC WAS_ENDIF WAS_IDENTIFIER WAS_ESU IN_DQUOTE IN_SQUOTE COMMENT - %% %\{ { /* lex/yacc C declarations/definitions */ @@ -771,7 +775,9 @@ if{wsnl}*\( { /* ignore 'if' */ unput(' '); } -"/*" yy_push_state(COMMENT); +"/*" { + yy_push_state(COMMENT); + } { [^*\n]* |