/* * yymore.lex: An example of using yymore() * to good effect. */ %{ #include void yyerror(char *message) { printf("Error: %s\n",message); } %} %x STRING %% \" yybegin(STRING); [^\\\n"]* yymore(); <> yyerror("EOF in string."); yybegin(INITIAL); \n yyerror("Unterminated string."); yybegin(INITIAL); \\\n yymore(); \" { yytext[yyleng-1] = '\0'; printf("string = \"%s\"",yytext); yybegin(INITIAL); } %%