Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!hplisa!hpmtlx!nag From: nag@hpmtlx.HP.COM ($Diwakar_Nag) Newsgroups: comp.lang.c Subject: Re: Lex and initial start conditions Message-ID: <300002@hpmtlx.HP.COM> Date: 29 May 90 22:53:01 GMT References: <6342@crabcake> Organization: HP Manufacturing Test Division - Loveland, CO Lines: 18 / hpmtlx:comp.lang.c / eifrig@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@cs.jhu.edu) Just use BEGIN 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