* * Anything else, (not an identifier, not a comment,
* and not whitespace). This will generate an error.
*/
-<HASH>define{HSPACE}+ {
+<HASH>define{HSPACE}* {
if (! parser->skipping) {
BEGIN DEFINE;
yyextra->space_tokens = 0;
<*>[\r\n] {
if (parser->commented_newlines) {
BEGIN NEWLINE_CATCHUP;
+ } else {
+ BEGIN INITIAL;
}
yyextra->space_tokens = 1;
yyextra->lexing_directive = 0;
<INITIAL,COMMENT,DEFINE,HASH><<EOF>> {
if (YY_START == COMMENT)
glcpp_error(yylloc, yyextra, "Unterminated comment");
- if (YY_START == DEFINE)
- glcpp_error(yylloc, yyextra, "#define without macro name");
BEGIN DONE; /* Don't keep matching this rule forever. */
yyextra->lexing_directive = 0;
if (! parser->last_token_was_newline)
HASH_TOKEN ERROR_TOKEN NEWLINE {
glcpp_error(& @1, parser, "#%s", $2);
}
+| HASH_TOKEN DEFINE_TOKEN NEWLINE {
+ glcpp_error (& @1, parser, "#define without macro name");
+ }
| HASH_TOKEN GARBAGE pp_tokens NEWLINE {
glcpp_error (& @1, parser, "Illegal non-directive after #");
}