From 94f0866683bdf063b30323bac227e11a23110fa2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 22 Aug 2009 10:20:34 +0200 Subject: Add call and template expressions Also add support for querying the lexer failure state. --- cli/token.hxx | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'cli/token.hxx') diff --git a/cli/token.hxx b/cli/token.hxx index c12d097..08918f8 100644 --- a/cli/token.hxx +++ b/cli/token.hxx @@ -23,7 +23,9 @@ public: t_char_lit, t_bool_lit, t_int_lit, - t_float_lit + t_float_lit, + t_call_expr, // The so called "call expression", e.g., (2, a). + t_template_expr // The so called "template expression", e.g., . }; Type @@ -52,9 +54,12 @@ public: k_int, k_long, k_float, - k_double + k_double, + k_invalid }; + // Return the keyword id if type is t_keyword and k_invalid otherwise. + // Keyword keyword () const; @@ -71,15 +76,19 @@ public: { p_semi, p_comma, - p_colon, + p_dcolon, p_lcbrace, p_rcbrace, - p_lparen, - p_rparen, + // p_lparen, + // p_rparen, p_eq, - p_or + p_or, + p_invalid }; + // Return the punctuation id if type is t_punctuation and p_invalid + // otherwise. + // Punctuation punctuation () const; @@ -89,6 +98,12 @@ public: std::string const& literal () const; + // Expressions. + // +public: + std::string const& + expression () const; + // C-tors. // public: @@ -99,7 +114,7 @@ public: Token (Keyword k, std::size_t l, std::size_t c); Token (Punctuation p, std::size_t l, std::size_t c); - // Identifier & literals. + // Identifier, literals, and expressions. // Token (Type t, std::string const& s, std::size_t l, std::size_t c); -- cgit v1.1