source: trunk/essentials/sys-devel/flex/examples/manual/yymore.lex@ 3285

Last change on this file since 3285 was 3031, checked in by bird, 19 years ago

flex 2.5.33.

File size: 566 bytes
Line 
1/*
2 * yymore.lex: An example of using yymore()
3 * to good effect.
4 */
5
6%{
7#include <memory.h>
8
9void 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%%
Note: See TracBrowser for help on using the repository browser.