From adfe85b2fd8559ee0947fed2eadc633421998f09 Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 12 Oct 2018 14:25:12 +0200 Subject: [PATCH] (HOA path) PrismParser: refactor double quoted identifiers --- prism/src/parser/PrismParser.jj | 50 +++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/prism/src/parser/PrismParser.jj b/prism/src/parser/PrismParser.jj index e3b5c87e..ed03b78c 100644 --- a/prism/src/parser/PrismParser.jj +++ b/prism/src/parser/PrismParser.jj @@ -511,12 +511,12 @@ TOKEN : | < PRIME: "'" > | < RENAME: "<-" > | < QMARK: "?" > -| < DQUOTE: "\"" > // Regular expressions | < REG_INT: (["1"-"9"](["0"-"9"])*)|("0") > | < REG_DOUBLE: (["0"-"9"])*(".")?(["0"-"9"])+(["e","E"](["-","+"])?(["0"-"9"])+)? > | < REG_IDENTPRIME: ["_","a"-"z","A"-"Z"](["_","a"-"z","A"-"Z","0"-"9"])*"'" > | < REG_IDENT: ["_","a"-"z","A"-"Z"](["_","a"-"z","A"-"Z","0"-"9"])* > +| < REG_QUOTED_IDENT: "\"" (["_","a"-"z","A"-"Z"](["_","a"-"z","A"-"Z","0"-"9"])*) "\"" > | < PREPROC: "#"(~["#"])*"#" > // Special catch-all token for lexical errors // (this allows us to throw our usual exceptions in this case) @@ -638,7 +638,7 @@ Property Property() : // (this avoids some common parsing errors for semicolon-less files) // Note also use of lookahead (to colon) to distinguish (optional) name from label reference ( { begin = getToken(1); } - ( LOOKAHEAD( Identifier() ) name = Identifier() )? + ( LOOKAHEAD(QuotedIdentifier() ) name = QuotedIdentifier() )? expr = ExpressionITE(true, false) { prop = new Property(expr, name, getPrecedingCommentBlock(begin)); } ) @@ -705,7 +705,7 @@ void LabelDef(LabelList labelList) throws PrismLangException : } { // Lookahead required because of the error handling clause below - LOOKAHEAD(