1*3c3a7b76Schristos /* 2*3c3a7b76Schristos * yymore.lex: An example of using yymore() 3*3c3a7b76Schristos * to good effect. 4*3c3a7b76Schristos */ 5*3c3a7b76Schristos 6*3c3a7b76Schristos %{ 7*3c3a7b76Schristos #include <memory.h> 8*3c3a7b76Schristos yyerror(char * message)9*3c3a7b76Schristosvoid yyerror(char *message) 10*3c3a7b76Schristos { 11*3c3a7b76Schristos printf("Error: %s\n",message); 12*3c3a7b76Schristos } 13*3c3a7b76Schristos 14*3c3a7b76Schristos %} 15*3c3a7b76Schristos 16*3c3a7b76Schristos %x STRING 17*3c3a7b76Schristos 18*3c3a7b76Schristos %% 19*3c3a7b76Schristos \" BEGIN(STRING); 20*3c3a7b76Schristos 21*3c3a7b76Schristos <STRING>[^\\\n"]* yymore(); 22*3c3a7b76Schristos <STRING><<EOF>> yyerror("EOF in string."); BEGIN(INITIAL); 23*3c3a7b76Schristos <STRING>\n yyerror("Unterminated string."); BEGIN(INITIAL); 24*3c3a7b76Schristos <STRING>\\\n yymore(); 25*3c3a7b76Schristos <STRING>\" { 26*3c3a7b76Schristos yytext[yyleng-1] = '\0'; 27*3c3a7b76Schristos printf("string = \"%s\"",yytext); BEGIN(INITIAL); 28*3c3a7b76Schristos } 29*3c3a7b76Schristos %% 30