Boost logo

Boost :

Subject: [boost] [spirit] [lex] semantic actions to handle and manipulate eoi
From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2013-05-12 07:48:36


Hi,

I want to replace a flex lexer with boost.spirit.lex. We implemented an
include-like functionality inside the lexer semantic actions:

include { BEGIN(incl) }
<EOF> { leaveCurrentFile(); popScannerState(); }
<incl> {
".+" { openNewFile(); pushScannerState(); BEGIN(INITIAL); }
}

Is there a way to do that in lexertl?
I thought about extending the spirit file_iterator but found that unwieldy.
So I now consider adding a semantic actions that are allowed to change
lex::_eoi and the ability to have a eoi token or just a semantic action to
handle eoi.

Is that a reasonable way of implementing that?

regards
Andreas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk