Using Lex (and Yacc) on a string.

Chris Torek chris at mimsy.umd.edu
Tue Aug 14 21:58:30 AEST 1990


In article <25996 at mimsy.umd.edu> I suggested:
>#define unput(c) (mystring--)

(and then eventually)

>#define unput(c) ((c) ? mystr-- : 0)

The first of these will fail because lex uses unput as

	unput(*--yylastch)

and

	unput(*yylastch--)

Thanks to Brad White for noticing this error.  The first one should
be `#define unput(c) ((c), mystring--)'.

(This is what I get for making changes to lex things based on theoretical
arguments without checking to see whether lex uses good programming
practises :-) .)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris
	(New campus phone system, active sometime soon: +1 301 405 2750)



More information about the Comp.lang.c mailing list