help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Eating" comments: not with Flex but with Bison


From: Hans Aberg
Subject: Re: "Eating" comments: not with Flex but with Bison
Date: Mon, 13 Jun 2005 23:31:08 +0200

At 20:46 +0000 2005/06/13, Frans Englich wrote:
I think I have a special scenario wrt. to comment handling: in one version of
my language, comments are allowed while in another it is not. Hence,
depending on version I want to flag the existence of comments as syntax
errors, regardless of whether they are valid.

You could try to set a context switch in the lexer (see the Flex manual, "start conditions") on the comment lexing rule(s). Then this context switch can be turned on/off in various ways. For example, the lexer could be initiated (right after %% in the .l file) with checking a global variable doing this. This variable can be turned on/off from the parser.
--
  Hans Aberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]