Lex and initial start conditions
$Diwakar_Nag
nag at hpmtlx.HP.COM
Wed May 30 08:53:01 AEST 1990
/ hpmtlx:comp.lang.c / eifrig at crabcake.cs.jhu.edu (Jonathan Eifrig) / 6:42 pm May 24, 1990 /
> I have a not-so-basic question about Lex and its input specific-
>ations. I want to write a simple parser, and in particular want to sup-
>port nested comments. The basic idea to use Lex's start conditions:
> ....
> ....
> Jack Eifrig
> (eifrig at cs.jhu.edu)
Just use BEGIN <state_name> eg . BEGIN COMMENT. Since BEGIN is a macro,
and it refers to some global variables defined by lex, it is a good idea to
define a function like InitScanner() which just calls BEGIN macro in the lex
specs. file. InitScanner() can be used in a different file without worrying
about global vars. used by BEGIN.
-diwakar
More information about the Comp.lang.c
mailing list