diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-15 10:43:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-15 10:43:16 +0200 |
commit | 835ed5f7080a98e9ee80ac08d5585ccdbb63fe0e (patch) | |
tree | 23eda92dd9df59e698f6d4a1eb24658fb3fcf323 /build/token | |
parent | 257ad3c2c5e633d2fd3f2228021ac3ae8d6d07cb (diff) |
Parse directory scopes
Diffstat (limited to 'build/token')
-rw-r--r-- | build/token | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/build/token b/build/token index 6f4951c..9f9b2b4 100644 --- a/build/token +++ b/build/token @@ -13,8 +13,15 @@ namespace build { - enum class token_type {eos, name, punctuation}; - enum class token_punctuation {newline, colon, lcbrace, rcbrace}; + enum class token_type + { + eos, + name, + newline, + colon, + lcbrace, + rcbrace + }; class token { @@ -25,32 +32,18 @@ namespace build std::string const& name () const {assert (t_ == token_type::name); return n_;} - token_punctuation - punctuation () const {assert (t_ == token_type::punctuation); return p_;} - - bool - is (token_punctuation p) const - { - return t_ == token_type::punctuation && p_ == p; - } - std::uint64_t line () const {return l_;} std::uint64_t column () const {return c_;} public: - token (std::uint64_t l, std::uint64_t c) - : t_ (token_type::eos), l_ (l), c_ (c) {} + token (token_type t, std::uint64_t l, std::uint64_t c) + : t_ (t), 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 (token_punctuation p, std::uint64_t l, std::uint64_t c) - : t_ (token_type::punctuation), p_ (p), l_ (l), c_ (c) {} - private: token_type t_; - - token_punctuation p_; std::string n_; std::uint64_t l_; |