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