summaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/antlr_parser.cpp6
-rw-r--r--src/parser/antlr_parser.h2
-rw-r--r--src/parser/cvc/cvc_parser.g7
-rw-r--r--src/parser/smt/smt_parser.g7
4 files changed, 10 insertions, 12 deletions
diff --git a/src/parser/antlr_parser.cpp b/src/parser/antlr_parser.cpp
index 961915523..dbaebf5a5 100644
--- a/src/parser/antlr_parser.cpp
+++ b/src/parser/antlr_parser.cpp
@@ -104,11 +104,11 @@ bool AntlrParser::isDeclared(string name, SymbolType type) {
void AntlrParser::rethrow(antlr::SemanticException& e, string new_message)
throw (antlr::SemanticException) {
throw antlr::SemanticException(new_message, getFilename(),
- LT(0).get()->getLine(),
- LT(0).get()->getColumn());
+ LT(1).get()->getLine(),
+ LT(1).get()->getColumn());
}
-bool AntlrParser::checkDeclation(string varName, DeclarationCheck check) {
+bool AntlrParser::checkDeclaration(string varName, DeclarationCheck check) {
switch(check) {
case CHECK_DECLARED:
return isDeclared(varName, SYM_VARIABLE);
diff --git a/src/parser/antlr_parser.h b/src/parser/antlr_parser.h
index 5cbb7411e..3025d44da 100644
--- a/src/parser/antlr_parser.h
+++ b/src/parser/antlr_parser.h
@@ -114,7 +114,7 @@ protected:
* @oaram check the kind of check to perform
* @return true if the check holds
*/
- bool checkDeclation(std::string varName, DeclarationCheck check);
+ bool checkDeclaration(std::string varName, DeclarationCheck check);
/**
* Types of symbols.
diff --git a/src/parser/cvc/cvc_parser.g b/src/parser/cvc/cvc_parser.g
index cb9c9b160..1cbdbd067 100644
--- a/src/parser/cvc/cvc_parser.g
+++ b/src/parser/cvc/cvc_parser.g
@@ -87,10 +87,9 @@ identifierList[std::vector<std::string>& idList, DeclarationCheck check = CHECK_
* Matches an identifier and returns a string.
*/
identifier[DeclarationCheck check = CHECK_NONE] returns [std::string id]
- : x:IDENTIFIER { checkDeclation(x->getText(), check) }?
- {
- id = x->getText();
- }
+ : x:IDENTIFIER
+ { id = x->getText(); }
+ { checkDeclaration(id, check) }?
exception catch [antlr::SemanticException& ex] {
switch (check) {
case CHECK_DECLARED: rethrow(ex, "Symbol " + id + " not declared");
diff --git a/src/parser/smt/smt_parser.g b/src/parser/smt/smt_parser.g
index 84b38c5cf..0db89d4f1 100644
--- a/src/parser/smt/smt_parser.g
+++ b/src/parser/smt/smt_parser.g
@@ -96,10 +96,9 @@ benchAttribute returns [Command* smt_command = 0]
* @return the id string
*/
identifier[DeclarationCheck check = CHECK_NONE] returns [std::string id]
- : x:IDENTIFIER { checkDeclation(x->getText(), check) }?
- {
- id = x->getText();
- }
+ : x:IDENTIFIER
+ { id = x->getText(); }
+ { checkDeclaration(id, check) }?
exception catch [antlr::SemanticException& ex] {
switch (check) {
case CHECK_DECLARED: rethrow(ex, "Symbol " + id + " not declared");
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback