diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-03-30 20:22:33 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-03-30 20:22:33 +0000 |
commit | 8730e9320a833a9eb0e65074f9988950b7424c0c (patch) | |
tree | 1cb09404256743e208fece079ba473595e05edcd /src/main | |
parent | 8c87c05ac56a5f29b2ae1e658f2d7d3b7b588163 (diff) |
Merging from branches/antlr3 (r246:354)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/.gitignore | 2 | ||||
-rw-r--r-- | src/main/Makefile.am | 2 | ||||
-rw-r--r-- | src/main/getopt.cpp | 11 | ||||
-rw-r--r-- | src/main/main.cpp | 35 |
4 files changed, 25 insertions, 25 deletions
diff --git a/src/main/.gitignore b/src/main/.gitignore new file mode 100644 index 000000000..f39e98071 --- /dev/null +++ b/src/main/.gitignore @@ -0,0 +1,2 @@ +/.deps +/Makefile.in diff --git a/src/main/Makefile.am b/src/main/Makefile.am index 79eb8c74e..e73b38f1d 100644 --- a/src/main/Makefile.am +++ b/src/main/Makefile.am @@ -1,5 +1,5 @@ AM_CPPFLAGS = \ - -I@srcdir@/../include -I@srcdir@/.. + -I@srcdir@/../include -I@srcdir@/.. $(ANTLR_INCLUDES) AM_CXXFLAGS = -Wall bin_PROGRAMS = cvc4 diff --git a/src/main/getopt.cpp b/src/main/getopt.cpp index df94ef9ab..ad59e0039 100644 --- a/src/main/getopt.cpp +++ b/src/main/getopt.cpp @@ -30,11 +30,10 @@ #include "util/configuration.h" #include "util/output.h" #include "util/options.h" -#include "parser/parser.h" +#include "parser/parser_options.h" using namespace std; using namespace CVC4; -using namespace CVC4::parser; namespace CVC4 { namespace main { @@ -153,13 +152,13 @@ throw(OptionException) { case 'L': if(!strcmp(optarg, "cvc4") || !strcmp(optarg, "pl")) { - opts->lang = Parser::LANG_CVC4; + opts->lang = parser::LANG_CVC4; break; } else if(!strcmp(optarg, "smtlib") || !strcmp(optarg, "smt")) { - opts->lang = Parser::LANG_SMTLIB; + opts->lang = parser::LANG_SMTLIB; break; } else if(!strcmp(optarg, "auto")) { - opts->lang = Parser::LANG_AUTO; + opts->lang = parser::LANG_AUTO; break; } @@ -187,7 +186,7 @@ throw(OptionException) { // silences CVC4 (except "sat" or "unsat" or "unknown", forces smtlib input) opts->smtcomp_mode = true; opts->verbosity = -1; - opts->lang = Parser::LANG_SMTLIB; + opts->lang = parser::LANG_SMTLIB; break; case PARSE_ONLY: diff --git a/src/main/main.cpp b/src/main/main.cpp index f5e53f34a..b65d4f50a 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -22,7 +22,7 @@ #include "config.h" #include "main.h" #include "usage.h" -#include "parser/parser.h" +#include "parser/input.h" #include "expr/expr_manager.h" #include "smt/smt_engine.h" #include "expr/command.h" @@ -93,6 +93,11 @@ int runCvc4(int argc, char* argv[]) { cout << unitbuf; } + /* NOTE: ANTLR3 doesn't support input from stdin */ + if(firstArgIndex >= argc) { + throw Exception("No input file specified."); + } + // We only accept one input file if(argc > firstArgIndex + 1) { throw Exception("Too many input files specified."); @@ -105,17 +110,17 @@ int runCvc4(int argc, char* argv[]) { SmtEngine smt(&exprMgr, &options); // If no file supplied we read from standard input - bool inputFromStdin = firstArgIndex >= argc || !strcmp("-", argv[firstArgIndex]); + // bool inputFromStdin = firstArgIndex >= argc || !strcmp("-", argv[firstArgIndex]); // Auto-detect input language by filename extension - if(!inputFromStdin && options.lang == Parser::LANG_AUTO) { + if(/*!inputFromStdin && */options.lang == parser::LANG_AUTO) { const char* filename = argv[firstArgIndex]; unsigned len = strlen(filename); if(len >= 4 && !strcmp(".smt", filename + len - 4)) { - options.lang = Parser::LANG_SMTLIB; + options.lang = parser::LANG_SMTLIB; } else if(( len >= 4 && !strcmp(".cvc", filename + len - 4) ) || ( len >= 5 && !strcmp(".cvc4", filename + len - 5) )) { - options.lang = Parser::LANG_CVC4; + options.lang = parser::LANG_CVC4; } } @@ -141,21 +146,15 @@ int runCvc4(int argc, char* argv[]) { } // Create the parser - Parser* parser; + Input* parser; istream* input = NULL; - if(inputFromStdin) { - parser = Parser::getNewParser(&exprMgr, options.lang, cin, "<stdin>"); - } else if( options.memoryMap ) { - parser = Parser::getMemoryMappedParser(&exprMgr, options.lang, argv[firstArgIndex]); - } else { - string filename = argv[firstArgIndex]; - input = new ifstream(filename.c_str()); - if(!*input) { - throw Exception("file does not exist or is unreadable: " + filename); - } - parser = Parser::getNewParser(&exprMgr, options.lang, *input, filename); - } +// if(inputFromStdin) { + // parser = Parser::getNewParser(&exprMgr, options.lang, cin, "<stdin>"); +// } else { + parser = Input::newFileParser(&exprMgr, options.lang, argv[firstArgIndex], + options.memoryMap); +// } if(!options.semanticChecks) { parser->disableChecks(); |