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


Hi!

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

According to the quick ref for semantic actions,

http://www.boost.org/doc/libs/1_57_0/libs/spirit/doc/html/spirit/lex/abstracts/lexer_semantic_actions.html

the context contains functions
     std::size_t get_state() const
and
     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

http://www.boost.org/doc/libs/1_57_0/libs/spirit/doc/html/spirit/lex/reference/lexer_concepts/lexer.html

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.

Regards
Claas


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