1 /* $Id: lemonflex-head.inc,v 1.1 2001/02/01 20:21:25 gram Exp $ */
3 /* This file is #include'd at the top of a Lex/Flex scanner
4 for use with the Lemon parser. You must have #define'd:
6 LVAL name of lval variable
7 LVAL_TYPE type of lval variable
8 LVAL_INIT_VAL Initial value of lval variable
12 /* Flex has a few routines which help us get the scanner to read
13 * from a string rather than from a file. POSIX lex only provides
14 * for reading from a file; any method of reading from a string
15 * is inherently non-portable. Besides reading from a string,
16 * we have to worry about resetting the scanner after a bad
17 * parse; this too is non-portable. Combine the reset with
18 * a string input, and you have major non-portability. I'll provide
19 * the routines for flex here. If you really want to modify the
20 * scanner and use a non-flex lex implementation, you may
21 * add more ifdef's below.
25 /* If we don't need yyunput, use this macro to get it out of the
26 * generated C file, avoiding a compiler warning about its lack of use */
30 /* Yup, I'm using a non-standard type for lval, unlike usual lex/yacc implementations.
31 * I can do so because I'm *not* using yacc, I'm using Lemon, where I have
32 * more control of the interaction between scanner and parser. */
33 LVAL_TYPE LVAL = LVAL_INIT_VAL;