diff options
author | David Robillard <d@drobilla.net> | 2009-07-04 05:02:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-07-04 05:02:09 +0000 |
commit | 7164809b051050fb4f4877793b9739b6177bcab1 (patch) | |
tree | a0ac0ed6731ddf6e453c81a9391566202a6f6c09 /src/repl.cpp | |
parent | 9e12b8536648a30377040f407e06ea0713db91b4 (diff) | |
download | resp-7164809b051050fb4f4877793b9739b6177bcab1.tar.gz resp-7164809b051050fb4f4877793b9739b6177bcab1.tar.bz2 resp-7164809b051050fb4f4877793b9739b6177bcab1.zip |
Ditch Exp type and use AST even at lex time.
git-svn-id: http://svn.drobilla.net/resp/tuplr@182 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/repl.cpp')
-rw-r--r-- | src/repl.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/repl.cpp b/src/repl.cpp index 1ec1834..bca6037 100644 --- a/src/repl.cpp +++ b/src/repl.cpp @@ -32,12 +32,12 @@ eval(CEnv& cenv, const string& name, istream& is) { AST* result = NULL; AType* resultType = NULL; - list< pair<SExp, AST*> > exprs; + list< pair<AST*, AST*> > exprs; Cursor cursor(name); try { while (true) { - SExp exp = readExpression(cursor, is); - if (exp.type == SExp::LIST && exp.empty()) + AST* exp = readExpression(cursor, is); + if (exp->to<ATuple*>() && exp->to<ATuple*>()->empty()) break; result = cenv.penv.parse(exp); // Parse input @@ -71,7 +71,7 @@ eval(CEnv& cenv, const string& name, istream& is) CFunction f = cenv.engine()->startFunction(cenv, "main", resultType, ATuple(cursor)); // Compile all expressions into it - for (list< pair<SExp, AST*> >::const_iterator i = exprs.begin(); i != exprs.end(); ++i) + for (list< pair<AST*, AST*> >::const_iterator i = exprs.begin(); i != exprs.end(); ++i) val = cenv.compile(i->second); // Finish and call it @@ -102,8 +102,8 @@ repl(CEnv& cenv) Cursor cursor("(stdin)"); try { - SExp exp = readExpression(cursor, std::cin); - if (exp.type == SExp::LIST && exp.empty()) + AST* exp = readExpression(cursor, std::cin); + if (exp->to<ATuple*>() && exp->to<ATuple*>()->empty()) break; AST* body = cenv.penv.parse(exp); // Parse input |