void collect(LexerDef& lexdef, String_ const& state , String_ const& targetstate) const { std::size_t state_id = lexdef.add_state(state.c_str()); // If the following assertion fires you are probably trying to use // a single string_token_def instance in more than one lexer state. // This is not possible. Please create a separate token_def instance // from the same regular expression for each lexer state it needs // to be associated with. BOOST_ASSERT( (std::size_t(~0) == token_state_ || state_id == token_state_) && "Can't use single string_token_def with more than one lexer state"); char_type const* target = targetstate.empty() ? 0 : targetstate.c_str(); if (target) lexdef.add_state(target); token_state_ = state_id; typedef typename LexerDef::id_type id_type; if (std::size_t(~0) == id_) id_ = lexdef.get_next_id(); unique_id_ = lexdef.add_token (state.c_str(), str_, id_, target); }
void collect(LexerDef& lexdef, State const& state) const { typedef typename LexerDef::id_type id_type; if (std::size_t(~0) == id_) id_ = lexdef.get_next_id(); unique_id_ = lexdef.add_token (state.c_str(), str_, id_); }
static void collect(Component const& component, LexerDef& lexdef, String const& state) { typedef typename LexerDef::id_type id_type; lexdef.add_token (state.c_str(), subject(component), next_id<id_type>::get()); }
static void collect(Component const& component, LexerDef& lexdef, String const& state) { typedef typename result_of::subject<Component>::type char_type; char_type c = subject(component); lexdef.add_token (state.c_str(), lex::detail::escape(c), static_cast<std::size_t>(c)); }