[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Francois Pottier <Francois.Pottier@i...> |
| Subject: | Re: [Caml-list] Re: The lexer hack |
Hello,
On Tue, Nov 10, 2009 at 08:26:23AM -0800, Dario Teixeira wrote:
> Anyway, I was looking at Dypgen's early actions, and an idea
> occurred to me: I can create dummy empty actions that simply
> change a global "parsing context" variable:
>
> inline:
> | (...)
> | BEGIN_VERB enter_verb RAW END_VERB exit_verb {Ast.Verbatim $3}
> | (...)
>
> enter_verb: /* empty */ {Global.context := Global.Verbatim}
> exit_verb: /* empty */ {Global.context := Global.General}
>
>
> Still hackish, but better than creating a state machine...
Interesting. Have you confirmed that this works? I am slightly worried by the
fact that an LR parser reads one token ahead, i.e. one token past BEGIN_VERB
might already have been read before the enter_verb semantic action is
executed. If that is so, then this token would be read while the lexer is
still in the wrong mode.
--
François Pottier
Francois.Pottier@inria.fr
http://gallium.inria.fr/~fpottier/