summaryrefslogtreecommitdiff
path: root/src/main/interactive_shell.cpp
diff options
context:
space:
mode:
authorChristopher L. Conway <christopherleeconway@gmail.com>2010-10-23 14:49:06 +0000
committerChristopher L. Conway <christopherleeconway@gmail.com>2010-10-23 14:49:06 +0000
commit0a3ecb598dac9e5e7416f88403dbf73d558c8739 (patch)
tree445375d28a4c0bd522115a1fdc40dc1190d6b7c6 /src/main/interactive_shell.cpp
parentb2ff9864ed706911022d7468cde7ba55d07ab1fd (diff)
Adding Parser::setInput and using it in InteractiveShell (Fixes: #225)
Removing ParserBuilder::withStateFrom
Diffstat (limited to 'src/main/interactive_shell.cpp')
-rw-r--r--src/main/interactive_shell.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/main/interactive_shell.cpp b/src/main/interactive_shell.cpp
index 3d37ade43..587c07495 100644
--- a/src/main/interactive_shell.cpp
+++ b/src/main/interactive_shell.cpp
@@ -18,6 +18,7 @@
#include "interactive_shell.h"
#include "expr/command.h"
+#include "parser/input.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
@@ -25,6 +26,8 @@ using namespace std;
namespace CVC4 {
+const string InteractiveShell::INPUT_FILENAME = "<shell>";
+
Command* InteractiveShell::readCommand() {
/* Don't do anything if the input is closed. */
if( d_in.eof() ) {
@@ -90,23 +93,26 @@ Command* InteractiveShell::readCommand() {
}
}
- Parser *parser =
- d_parserBuilder
- .withStringInput(input)
- .withStateFrom(d_lastParser)
- .build();
+ d_parser->setInput(Input::newStringInput(d_language,input,INPUT_FILENAME));
+ // Parser *parser =
+ // d_parserBuilder
+ // .withStringInput(input)
+ // .withStateFrom(d_lastParser)
+ // .build();
/* There may be more than one command in the input. Build up a
sequence. */
CommandSequence *cmd_seq = new CommandSequence();
Command *cmd;
- while( (cmd = parser->nextCommand()) ) {
+ while( (cmd = d_parser->nextCommand()) ) {
cmd_seq->addCommand(cmd);
}
- delete d_lastParser;
- d_lastParser = parser;
+ // if( d_lastParser ) {
+ // delete d_lastParser;
+ // }
+ // d_lastParser = parser;
return cmd_seq;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback