help-bison
[Top][All Lists]
Advanced

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

Re: concatenating string into $$


From: Hans Aberg
Subject: Re: concatenating string into $$
Date: Sun, 29 Feb 2004 01:37:18 +0100

At 09:35 -0800 2004/02/28, Tom Jackson wrote:
[In the future, cc the Bison list on all your replies, so that more can
help. I use the Bison list address as a reply address only because I have
tired on all newbies forgetting about that.]

>So in the above, I'm guessing, if the yytext for ENDIF were '}' it
>wouldn't need to be handled explicitly by the parser?

The normal is to let the parser handle this, to let proper stacking of
environments.

One can write .y code like:
%token left_brace_key "{"
%token right_brace_key "}"
...
%%
environment:
    "{" environment "}" {...}
  | ...
;

The lexer will return the tokens left_brace_key, etc. This will simplify
the grammar. In error messages, the Bison parser will use the strings "{".

  Hans Aberg






reply via email to

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