From 48b94da0994b44e41324a2419117dcd81facce8b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 13 May 2010 10:46:29 -0700 Subject: Make the lexer return SPACE tokens unconditionally. It seems strange to always be returning SPACE tokens, but since we were already needing to return a SPACE token in some cases, this actually simplifies our lexer. This also allows us to fix two whitespace-handling differences compared to "gcc -E" so that now the recent modification to the test suite passes once again. --- glcpp-lex.l | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'glcpp-lex.l') diff --git a/glcpp-lex.l b/glcpp-lex.l index 3c9dda46d4..21b9e3530a 100644 --- a/glcpp-lex.l +++ b/glcpp-lex.l @@ -32,9 +32,6 @@ %option reentrant noyywrap %option extra-type="glcpp_parser_t *" -%x ST_DEFINE -%x ST_DEFVAL - SPACE [[:space:]] NONSPACE [^[:space:]] NEWLINE [\n] @@ -55,31 +52,9 @@ TOKEN [^[:space:](),]+ * "#define foo()" from "#define foo ()". */ {HASH}define{HSPACE}* { - BEGIN ST_DEFINE; return DEFINE; } -{IDENTIFIER} { - BEGIN ST_DEFVAL; - yylval.str = xtalloc_strdup (yyextra, yytext); - return IDENTIFIER; -} - -\n { - BEGIN INITIAL; - return NEWLINE; -} - -{HSPACE}+ { - BEGIN INITIAL; - return SPACE; -} - -"(" { - BEGIN INITIAL; - return '('; -} - {IDENTIFIER} { yylval.str = xtalloc_strdup (yyextra, yytext); switch (glcpp_parser_macro_type (yyextra, yylval.str)) @@ -109,6 +84,8 @@ TOKEN [^[:space:](),]+ return NEWLINE; } -{SPACE}+ +{HSPACE}+ { + return SPACE; +} %% -- cgit v1.2.3