diff options
author | John Hodge (bugs) <tpg@mutabah.net> | 2014-12-07 09:46:00 +0800 |
---|---|---|
committer | John Hodge (bugs) <tpg@mutabah.net> | 2014-12-07 09:46:00 +0800 |
commit | c325b671c1a44c90c8ce570b901219bcc2ae0a38 (patch) | |
tree | 5dff25da15192ad0b0635fa96bab5f510df018c6 /parse/lex.cpp | |
parent | 1ac5429531c195755c7e1690912291e20e9a1717 (diff) | |
download | mrust-c325b671c1a44c90c8ce570b901219bcc2ae0a38.tar.gz |
Macro evaluation hacked in (... not quite in yet, but framework is there)
Macro definitions not implemented, evil hack to define try! is present
Diffstat (limited to 'parse/lex.cpp')
-rw-r--r-- | parse/lex.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/parse/lex.cpp b/parse/lex.cpp index 99568a11..99d787fb 100644 --- a/parse/lex.cpp +++ b/parse/lex.cpp @@ -133,9 +133,9 @@ static const struct { TOKENT("pure", TOK_RWORD_PURE),
TOKENT("ref", TOK_RWORD_REF),
TOKENT("return", TOK_RWORD_RETURN),
+ TOKENT("self", TOK_RWORD_SELF),
TOKENT("sizeof", TOK_RWORD_SIZEOF),
TOKENT("static", TOK_RWORD_STATIC),
- TOKENT("self", TOK_RWORD_SELF),
TOKENT("struct", TOK_RWORD_STRUCT),
TOKENT("super", TOK_RWORD_SUPER),
TOKENT("true", TOK_RWORD_TRUE),
@@ -416,7 +416,6 @@ const char* Token::typestr(enum eTokenType type) case TOK_INTEGER: return "TOK_INTEGER";
case TOK_CHAR: return "TOK_CHAR";
case TOK_FLOAT: return "TOK_FLOAT";
- case TOK_UNDERSCORE: return "TOK_UNDERSCORE";
case TOK_CATTR_OPEN: return "TOK_CATTR_OPEN";
case TOK_ATTR_OPEN: return "TOK_ATTR_OPEN";
@@ -542,3 +541,50 @@ const char* Token::typestr(enum eTokenType type) return os;
}
+TokenTree::TokenTree(Token tok)
+{
+
+}
+TokenTree::TokenTree(::std::vector<TokenTree> subtrees)
+{
+
+}
+
+TTStream::TTStream(const TokenTree& input_tt):
+ m_input_tt(input_tt),
+ m_cur_layer(&input_tt)
+{
+}
+TTStream::~TTStream()
+{
+}
+Token TTStream::realGetToken()
+{
+ return Token(TOK_EOF);
+}
+
+TokenStream::TokenStream():
+ m_cache_valid(false)
+{
+}
+TokenStream::~TokenStream()
+{
+}
+
+Token TokenStream::getToken()
+{
+ if( m_cache_valid )
+ {
+ m_cache_valid = false;
+ return m_cache;
+ }
+ else
+ {
+ return this->realGetToken();
+ }
+}
+void TokenStream::putback(Token tok)
+{
+ m_cache_valid = true;
+ m_cache = tok;
+}
|