diff options
Diffstat (limited to 'src/parse/tokentree.hpp')
-rw-r--r-- | src/parse/tokentree.hpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/src/parse/tokentree.hpp b/src/parse/tokentree.hpp index 8472ec7f..26e23876 100644 --- a/src/parse/tokentree.hpp +++ b/src/parse/tokentree.hpp @@ -1,61 +1,61 @@ -/*
- * MRustC - Rust Compiler
- * - By John Hodge (Mutabah/thePowersGang)
- *
- * parse/tokentree.hpp
- * - Token Trees (groups of tokens
- */
-#ifndef TOKENTREE_HPP_INCLUDED
-#define TOKENTREE_HPP_INCLUDED
-
-#include "token.hpp"
-#include <ident.hpp>
-#include <vector>
-
-class TokenTree
-{
- Ident::Hygiene m_hygiene;
- Token m_tok;
- ::std::vector<TokenTree> m_subtrees;
-public:
- virtual ~TokenTree() {}
- TokenTree() {}
- TokenTree(TokenTree&&) = default;
- TokenTree& operator=(TokenTree&&) = default;
- TokenTree(enum eTokenType ty):
- m_tok( Token(ty) )
- {
- }
- TokenTree(Token tok):
- m_tok( ::std::move(tok) )
- {
- }
- TokenTree(Ident::Hygiene hygiene, Token tok):
- m_hygiene( ::std::move(hygiene) ),
- m_tok( ::std::move(tok) )
- {
- }
- TokenTree(Ident::Hygiene hygiene, ::std::vector<TokenTree> subtrees):
- m_hygiene( ::std::move(hygiene) ),
- m_subtrees( ::std::move(subtrees) )
- {
- }
-
- TokenTree clone() const;
-
- bool is_token() const {
- return m_tok.type() != TOK_NULL;
- }
- unsigned int size() const {
- return m_subtrees.size();
- }
- const TokenTree& operator[](unsigned int idx) const { return m_subtrees[idx]; }
- TokenTree& operator[](unsigned int idx) { return m_subtrees[idx]; }
- const Token& tok() const { return m_tok; }
- Token& tok() { return m_tok; }
- const Ident::Hygiene& hygiene() const { return m_hygiene; }
-
- friend ::std::ostream& operator<<(::std::ostream& os, const TokenTree& tt);
-};
-
-#endif // TOKENTREE_HPP_INCLUDED
+/* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * parse/tokentree.hpp + * - Token Trees (groups of tokens + */ +#ifndef TOKENTREE_HPP_INCLUDED +#define TOKENTREE_HPP_INCLUDED + +#include "token.hpp" +#include <ident.hpp> +#include <vector> + +class TokenTree +{ + Ident::Hygiene m_hygiene; + Token m_tok; + ::std::vector<TokenTree> m_subtrees; +public: + virtual ~TokenTree() {} + TokenTree() {} + TokenTree(TokenTree&&) = default; + TokenTree& operator=(TokenTree&&) = default; + TokenTree(enum eTokenType ty): + m_tok( Token(ty) ) + { + } + TokenTree(Token tok): + m_tok( ::std::move(tok) ) + { + } + TokenTree(Ident::Hygiene hygiene, Token tok): + m_hygiene( ::std::move(hygiene) ), + m_tok( ::std::move(tok) ) + { + } + TokenTree(Ident::Hygiene hygiene, ::std::vector<TokenTree> subtrees): + m_hygiene( ::std::move(hygiene) ), + m_subtrees( ::std::move(subtrees) ) + { + } + + TokenTree clone() const; + + bool is_token() const { + return m_tok.type() != TOK_NULL; + } + unsigned int size() const { + return m_subtrees.size(); + } + const TokenTree& operator[](unsigned int idx) const { return m_subtrees[idx]; } + TokenTree& operator[](unsigned int idx) { return m_subtrees[idx]; } + const Token& tok() const { return m_tok; } + Token& tok() { return m_tok; } + const Ident::Hygiene& hygiene() const { return m_hygiene; } + + friend ::std::ostream& operator<<(::std::ostream& os, const TokenTree& tt); +}; + +#endif // TOKENTREE_HPP_INCLUDED |