summaryrefslogtreecommitdiff
path: root/cli/token.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-08-22 10:20:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-08-22 10:20:34 +0200
commit94f0866683bdf063b30323bac227e11a23110fa2 (patch)
treec484de46d07f1d0b8fdffb6dd7573f7047e1b2cb /cli/token.hxx
parentc3f7f0c0556270ced988a7adddec885270bc1ea7 (diff)
Add call and template expressions
Also add support for querying the lexer failure state.
Diffstat (limited to 'cli/token.hxx')
-rw-r--r--cli/token.hxx29
1 files changed, 22 insertions, 7 deletions
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., <foo, 3>.
};
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);