etc/services - sync with NetBSD-8
[minix.git] / external / bsd / flex / dist / examples / manual / yymore2.lex
blobf49ea237c5d412742bd0a5280e480e853aff8627
1 /*
2  * yymore.lex: An example of using yymore()
3  *             to good effect.
4  */
6 %{
7 #include <memory.h>
9 void yyerror(char *message)
11   printf("Error: %s\n",message);
16 %x STRING
19 \"   BEGIN(STRING);
21 <STRING>[^\\\n"]*  yymore();
22 <STRING><<EOF>>    yyerror("EOF in string.");       BEGIN(INITIAL);
23 <STRING>\n         yyerror("Unterminated string."); BEGIN(INITIAL);
24 <STRING>\\\n      {
25                      bcopy(yytext,yytext+2,yyleng-2);
26                      yytext += 2; yyleng -= 2;
27                      yymore();
28                   }
29 <STRING>\"        {
30                      yyleng -= 1; yytext[yyleng] = '\0';
31                      printf("string = \"%s\"",yytext); BEGIN(INITIAL);
32                   }