Boost logo

Boost :

Subject: [boost] [Spirit] Lex context and lexer states
From: Claas H. Köhler (claashk_at_[hidden])
Date: 2014-11-04 11:51:58


Reading the documentation regarding the context object passed by spirit
lex I got a little confused:

According to the quick ref for semantic actions,

the context contains functions
     std::size_t get_state() const
     void set_state(std::size_t state).

So I presumed the state to be an object of type size_t. However,
according to the reference section on lexer concepts

the Lexer state is specified in string form. So my question is:

Do both representations exist (i.e. as string & size_t) and can be
mapped to each other ? If so, how? Or do I control the desired type via
a template parameter ?

Are there any examples in the docs containing different lexer states,
which could help me to understand the concept ?

Any help would be appreciated.


Boost list run by bdawes at, gregod at, cpdaniel at, john at