summaryrefslogtreecommitdiff
path: root/cli/token.ixx
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.ixx
parentc3f7f0c0556270ced988a7adddec885270bc1ea7 (diff)
Add call and template expressions
Also add support for querying the lexer failure state.
Diffstat (limited to 'cli/token.ixx')
-rw-r--r--cli/token.ixx10
1 files changed, 8 insertions, 2 deletions
diff --git a/cli/token.ixx b/cli/token.ixx
index bcf040a..93db6d8 100644
--- a/cli/token.ixx
+++ b/cli/token.ixx
@@ -24,7 +24,7 @@ column () const
inline Token::Keyword Token::
keyword () const
{
- return keyword_;
+ return type_ == t_keyword ? keyword_ : k_invalid;
}
inline std::string const& Token::
@@ -36,7 +36,7 @@ identifier () const
inline Token::Punctuation Token::
punctuation () const
{
- return punctuation_;
+ return type_ == t_punctuation ? punctuation_ : p_invalid;
}
inline std::string const& Token::
@@ -45,6 +45,12 @@ literal () const
return str_;
}
+inline std::string const& Token::
+expression () const
+{
+ return str_;
+}
+
inline Token::
Token (std::size_t l, std::size_t c)
: l_ (l), c_ (c), type_ (t_eos)