summaryrefslogtreecommitdiff
path: root/src/parser/smt2
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2013-06-07 15:23:36 -0400
committerMorgan Deters <mdeters@cs.nyu.edu>2013-06-07 15:23:36 -0400
commit931b5641dfffcd3779239e014406aa057e21e0f7 (patch)
treecc37b63036dc8cd88af2c8cb1ac4511d0befbf17 /src/parser/smt2
parent6a329424666b4c4a6869dd7bcf9e7cfd69a219f5 (diff)
Allow disabling include-file feature
Diffstat (limited to 'src/parser/smt2')
-rw-r--r--src/parser/smt2/Smt2.g5
-rw-r--r--src/parser/smt2/smt2.cpp5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g
index 29bc8d40f..5abaa0163 100644
--- a/src/parser/smt2/Smt2.g
+++ b/src/parser/smt2/Smt2.g
@@ -197,7 +197,10 @@ parseCommand returns [CVC4::Command* cmd = NULL]
* the RPAREN_TOK is properly eaten and we are in a good state to read
* the included file's tokens. */
| LPAREN_TOK INCLUDE_TOK str[name] RPAREN_TOK
- { if(PARSER_STATE->strictModeEnabled()) {
+ { if(!PARSER_STATE->canIncludeFile()) {
+ PARSER_STATE->parseError("include-file feature was disabled for this run.");
+ }
+ if(PARSER_STATE->strictModeEnabled()) {
PARSER_STATE->parseError("Extended commands are not permitted while operating in strict compliance mode.");
}
PARSER_STATE->includeFile(name);
diff --git a/src/parser/smt2/smt2.cpp b/src/parser/smt2/smt2.cpp
index be4907e8e..42324fe1e 100644
--- a/src/parser/smt2/smt2.cpp
+++ b/src/parser/smt2/smt2.cpp
@@ -242,6 +242,11 @@ static bool newInputStream(const std::string& filename, pANTLR3_LEXER lexer) {
}
void Smt2::includeFile(const std::string& filename) {
+ // security for online version
+ if(!canIncludeFile()) {
+ parseError("include-file feature was disabled for this run.");
+ }
+
// Get the lexer
AntlrInput* ai = static_cast<AntlrInput*>(getInput());
pANTLR3_LEXER lexer = ai->getAntlr3Lexer();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback