PARSE_ONLY,
NO_CHECKING,
USE_MMAP,
- SHOW_CONFIG
+ SHOW_CONFIG,
+ STRICT_PARSING
};/* enum OptionValue */
/**
{ "about" , no_argument , NULL, 'V' },
{ "lang" , required_argument, NULL, 'L' },
{ "parse-only" , no_argument , NULL, PARSE_ONLY },
- { "mmap", no_argument , NULL, USE_MMAP }
+ { "mmap", no_argument , NULL, USE_MMAP },
+ { "strict-parsing", no_argument , NULL, STRICT_PARSING },
};/* if you add things to the above, please remember to update usage.h! */
/** Full argv[0] */
opts->memoryMap = true;
break;
+ case STRICT_PARSING:
+ opts->strictParsing = true;
+ break;
+
case SHOW_CONFIG:
fputs(Configuration::about().c_str(), stdout);
printf("\n");
parser.disableChecks();
}
+ if( options.strictParsing ) {
+ parser.enableStrictMode();
+ }
+
// Parse and execute commands until we are done
Command* cmd;
while((cmd = parser.nextCommand())) {
}
}
-void Parser::enableChecks() {
- d_checksEnabled = true;
-}
-
-void Parser::disableChecks() {
- d_checksEnabled = false;
-}
-
Command* Parser::nextCommand() throw(ParserException) {
Debug("parser") << "nextCommand()" << std::endl;
Command* cmd = NULL;
/** Are semantic checks enabled during parsing? */
bool d_checksEnabled;
+ /** Are we parsing in strict mode? */
+ bool d_strictMode;
/** Lookup a symbol in the given namespace. */
Expr getSymbol(const std::string& var_name, SymbolType type);
}
/** Enable semantic checks during parsing. */
- void enableChecks();
+ void enableChecks() { d_checksEnabled = true; }
/** Disable semantic checks during parsing. Disabling checks may lead to crashes on bad inputs. */
- void disableChecks();
+ void disableChecks() { d_checksEnabled = false; }
+
+ /** Enable strict parsing, according to the language standards. */
+ void enableStrictMode() { d_strictMode = true; }
+
+ /** Disable strict parsing. Allows certain syntactic infelicities to pass without comment. */
+ void disableStrictMode() { d_strictMode = false; }
+
+ bool strictModeEnabled() { return d_strictMode; }
/** Get the name of the input file. */
/*
}
: /* a built-in operator application */
LPAREN_TOK builtinOp[kind] termList[args,expr] RPAREN_TOK
- { if((kind == CVC4::kind::AND || kind == CVC4::kind::OR) && args.size() == 1) {
+ { if( !PARSER_STATE->strictModeEnabled() &&
+ (kind == CVC4::kind::AND || kind == CVC4::kind::OR) &&
+ args.size() == 1) {
/* Unary AND/OR can be replaced with the argument.
It just so happens expr should already by the only argument. */
Assert( expr == args[0] );
/** Should the parser memory-map file input? */
bool memoryMap;
+ /** Should we strictly enforce the language standard while parsing? */
+ bool strictParsing;
+
Options() : binary_name(),
statistics(false),
out(0),
lang(parser::LANG_AUTO),
parseOnly(false),
semanticChecks(true),
- memoryMap(false)
+ memoryMap(false),
+ strictParsing(false)
{}
};/* struct Options */