aboutsummaryrefslogtreecommitdiff
path: root/build/token
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-02 09:52:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-02 09:52:59 +0200
commit4a9ee48613cf5c59e071400280b62358eb79987e (patch)
tree5a5546a3b090f88db00d21caccced186f5765786 /build/token
parentfbd3c230d3861084b7316a6d5a8597cb00c9510b (diff)
Indicate whether token is separated from previous one by whitespaces
Diffstat (limited to 'build/token')
-rw-r--r--build/token14
1 files changed, 10 insertions, 4 deletions
diff --git a/build/token b/build/token
index a071987..e6930ff 100644
--- a/build/token
+++ b/build/token
@@ -31,6 +31,11 @@ namespace build
token_type
type () const {return t_;}
+ // Token is whitespace-separated from the previous token.
+ //
+ bool
+ separated () const {return s_;}
+
std::string const&
name () const {assert (t_ == token_type::name); return n_;}
@@ -38,14 +43,15 @@ namespace build
std::uint64_t column () const {return c_;}
public:
- token (token_type t, std::uint64_t l, std::uint64_t c)
- : t_ (t), l_ (l), c_ (c) {}
+ token (token_type t, bool s, std::uint64_t l, std::uint64_t c)
+ : t_ (t), s_ (s), l_ (l), c_ (c) {}
- token (std::string n, std::uint64_t l, std::uint64_t c)
- : t_ (token_type::name), n_ (std::move (n)), l_ (l), c_ (c) {}
+ token (std::string n, bool s, std::uint64_t l, std::uint64_t c)
+ : t_ (token_type::name), s_ (s), n_ (std::move (n)), l_ (l), c_ (c) {}
private:
token_type t_;
+ bool s_;
std::string n_;
std::uint64_t l_;