summaryrefslogtreecommitdiff
path: root/cli/token.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-08-10 17:54:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-08-10 17:54:32 +0200
commitc3f7f0c0556270ced988a7adddec885270bc1ea7 (patch)
tree9fac46ab1e66a8be14ba46a2cf2c2a798d73adc6 /cli/token.hxx
parent8d796e32510dc00e0b6f25b841bff8425c54dc6b (diff)
Inline file for the Token class
Diffstat (limited to 'cli/token.hxx')
-rw-r--r--cli/token.hxx58
1 files changed, 13 insertions, 45 deletions
diff --git a/cli/token.hxx b/cli/token.hxx
index 0f4f714..c12d097 100644
--- a/cli/token.hxx
+++ b/cli/token.hxx
@@ -27,22 +27,13 @@ public:
};
Type
- type () const
- {
- return type_;
- }
+ type () const;
std::size_t
- line () const
- {
- return l_;
- }
+ line () const;
std::size_t
- column () const
- {
- return c_;
- }
+ column () const;
// Keyword
//
@@ -65,19 +56,13 @@ public:
};
Keyword
- keyword () const
- {
- return keyword_;
- }
+ keyword () const;
// Identifier
//
public:
std::string const&
- identifier () const
- {
- return str_;
- }
+ identifier () const;
// Punctuation
//
@@ -96,46 +81,27 @@ public:
};
Punctuation
- punctuation () const
- {
- return punctuation_;
- }
+ punctuation () const;
// Literals.
//
public:
std::string const&
- literal () const
- {
- return str_;
- }
+ literal () const;
// C-tors.
//
public:
// EOS.
//
- Token (std::size_t l, std::size_t c)
- : l_ (l), c_ (c), type_ (t_eos)
- {
- }
-
- Token (Keyword k, std::size_t l, std::size_t c)
- : l_ (l), c_ (c), type_ (t_keyword), keyword_ (k)
- {
- }
+ Token (std::size_t l, std::size_t c);
- Token (Punctuation p, std::size_t l, std::size_t c)
- : l_ (l), c_ (c), type_ (t_punctuation), punctuation_ (p)
- {
- }
+ Token (Keyword k, std::size_t l, std::size_t c);
+ Token (Punctuation p, std::size_t l, std::size_t c);
// Identifier & literals.
//
- Token (Type t, std::string const& s, std::size_t l, std::size_t c)
- : l_ (l), c_ (c), type_ (t), str_ (s)
- {
- }
+ Token (Type t, std::string const& s, std::size_t l, std::size_t c);
private:
std::size_t l_;
@@ -148,4 +114,6 @@ private:
std::string str_;
};
+#include "token.ixx"
+
#endif // CLI_TOKEN_HXX