summaryrefslogtreecommitdiff
path: root/cli/cli/token.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-04-08 14:51:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-27 11:38:53 +0300
commit720c5a33b6a49cf328fdd7611f49153cf8f60247 (patch)
tree9725f3d1f42ec90fde84520f49647edea013ce5e /cli/cli/token.ixx
parent3183f3bb927a90783ae0aeaf190a0919377aabe4 (diff)
Separate tests and examples into individual packages
Also make cli module to be explicitly enabled via the config.cli configuration variable.
Diffstat (limited to 'cli/cli/token.ixx')
-rw-r--r--cli/cli/token.ixx88
1 files changed, 88 insertions, 0 deletions
diff --git a/cli/cli/token.ixx b/cli/cli/token.ixx
new file mode 100644
index 0000000..77ab225
--- /dev/null
+++ b/cli/cli/token.ixx
@@ -0,0 +1,88 @@
+// file : cli/token.ixx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// license : MIT; see accompanying LICENSE file
+
+inline token::token_type token::
+type () const
+{
+ return type_;
+}
+
+inline std::size_t token::
+line () const
+{
+ return l_;
+}
+
+inline std::size_t token::
+column () const
+{
+ return c_;
+}
+
+inline token::keyword_type token::
+keyword () const
+{
+ return type_ == t_keyword ? keyword_ : k_invalid;
+}
+
+inline std::string const& token::
+identifier () const
+{
+ return str_;
+}
+
+inline token::punctuation_type token::
+punctuation () const
+{
+ return type_ == t_punctuation ? punctuation_ : p_invalid;
+}
+
+inline std::string const& token::
+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),
+ keyword_ (k_invalid),
+ punctuation_ (p_invalid)
+{
+}
+
+inline token::
+token (keyword_type k, std::size_t l, std::size_t c)
+ : l_ (l), c_ (c),
+ type_ (t_keyword),
+ keyword_ (k),
+ punctuation_ (p_invalid)
+{
+}
+
+inline token::
+token (punctuation_type p, std::size_t l, std::size_t c)
+ : l_ (l), c_ (c),
+ type_ (t_punctuation),
+ keyword_ (k_invalid),
+ punctuation_ (p)
+{
+}
+
+inline token::
+token (token_type t, std::string const& s, std::size_t l, std::size_t c)
+ : l_ (l), c_ (c),
+ type_ (t),
+ keyword_ (k_invalid),
+ punctuation_ (p_invalid),
+ str_ (s)
+{
+}