Lexer Struct Template Reference
[Series]

Lexer class for the rational expression parser. More...

List of all members.

Public Types

typedef KRatExpToken< typename
Element< S, T >::monoid_elt_value_t,
typename Element< S, T
>::semiring_elt_value_t > 
krat_exp_token_t
typedef std::list< krat_exp_token_ttoken_stream_t

Public Member Functions

 Lexer (bool trace=false)
void lex_error (const std::string &msg="Lex error.")
 Put the lexer into an error state.
void lex (const std::string &in, const Element< S, T > &e)
 Perform lexing.
bool error () const
 Return true when an error occured.
const std::string & error_msg () const
 Return the error message.
krat_exp_token_t first () const
 Return the first token.
krat_exp_token_t second () const
 Return the second token.
void eat ()
 Shift tokens.
void set_trace (bool trace)

Protected Attributes

token_stream_t tokens_
bool trace_
std::string error_msg_
bool error_


Detailed Description

template<class S, class T>
struct vcsn::algebra::Lexer< S, T >

Lexer class for the rational expression parser.

See also:
Parser

Definition at line 238 of file krat_exp_parser.hxx.


Member Function Documentation

void lex ( const std::string &  in,
const Element< S, T > &  e 
) [inline]

Perform lexing.

Parameters:
in The rational expression to lex, as a string.
e The element which will be used later for parsing. It used to guess words and semiring types.

Definition at line 271 of file krat_exp_parser.hxx.

References vcsn::algebra::krat_exp_lexing::dot, vcsn::algebra::krat_exp_lexing::e_star, Lexer::error_, vcsn::misc::escaped(), Lexer::lex_error(), vcsn::algebra::krat_exp_lexing::lparen, vcsn::algebra::krat_exp_lexing::one, vcsn::parse_weight(), vcsn::parse_word(), vcsn::algebra::krat_exp_lexing::plus, KRatExpToken::reset(), vcsn::algebra::krat_exp_lexing::rparen, vcsn::algebra::krat_exp_lexing::space, Element::structure(), Lexer::tokens_, vcsn::misc::usual_escaped_characters(), and vcsn::algebra::krat_exp_lexing::zero.

Referenced by vcsn::algebra::parse().

void eat (  )  [inline]

Shift tokens.

Remove the first token from the token stream. So second becames first, third becames second, and so on...

Definition at line 363 of file krat_exp_parser.hxx.

References Lexer::tokens_, and Lexer::trace_.


Generated on Sun Jul 29 19:49:28 2007 for Vaucanson by  doxygen 1.5.2