diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2013-03-01 18:31:10 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2013-03-25 20:35:54 -0400 |
commit | ef189453232a4dff9d3cfebafc6101bf8416b549 (patch) | |
tree | 3940f9d503cfc69431a3ac85b717fd4871241553 /src/parser/parser.cpp | |
parent | 30333c667c982a3ce4c4efcec705724d22f12ec2 (diff) |
java input stream adapters working
Diffstat (limited to 'src/parser/parser.cpp')
-rw-r--r-- | src/parser/parser.cpp | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index 8b77362b2..90f17426b 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -446,26 +446,20 @@ Command* Parser::nextCommand() throw(ParserException) { if(!d_commandQueue.empty()) { cmd = d_commandQueue.front(); d_commandQueue.pop_front(); - if(cmd == NULL) { - setDone(); - } + setDone(cmd == NULL); } else { - if(!done()) { - try { - cmd = d_input->parseCommand(); - d_commandQueue.push_back(cmd); - cmd = d_commandQueue.front(); - d_commandQueue.pop_front(); - if(cmd == NULL) { - setDone(); - } - } catch(ParserException& e) { - setDone(); - throw; - } catch(exception& e) { - setDone(); - parseError(e.what()); - } + try { + cmd = d_input->parseCommand(); + d_commandQueue.push_back(cmd); + cmd = d_commandQueue.front(); + d_commandQueue.pop_front(); + setDone(cmd == NULL); + } catch(ParserException& e) { + setDone(); + throw; + } catch(exception& e) { + setDone(); + parseError(e.what()); } } Debug("parser") << "nextCommand() => " << cmd << std::endl; @@ -478,9 +472,7 @@ Expr Parser::nextExpression() throw(ParserException) { if(!done()) { try { result = d_input->parseExpr(); - if(result.isNull()) { - setDone(); - } + setDone(result.isNull()); } catch(ParserException& e) { setDone(); throw; |