Eliminate quotedString parser construct
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / antlr / org / opendaylight / yangtools / antlrv4 / code / gen / YangStatementParser.g4
index 109b8a46c9965d0a12302c408141d86036418e85..8becc9717394895d4e60008c22f0631f94c4dc1e 100644 (file)
@@ -30,15 +30,14 @@ argument :
     // special and deserving of this treatment.
     IDENTIFIER
     |
-    unquotedString
+    // Quoted string and concatenations thereof. We are sacrificing brewity
+    // here to eliminate the need for another parser construct. Quoted strings
+    // account for about 50% of all arguments encountered -- hence the added
+    // parse tree indirection is very visible.
+    (DQUOT_START DQUOT_STRING? DQUOT_END | SQUOT_START SQUOT_STRING? SQUOT_END)
+    (SEP* PLUS SEP* (DQUOT_START DQUOT_STRING? DQUOT_END | SQUOT_START SQUOT_STRING? SQUOT_END))*
     |
-    quotedString (SEP* PLUS SEP* quotedString)*
-    ;
-
-quotedString :
-    DQUOT_START DQUOT_STRING? DQUOT_END
-    |
-    SQUOT_START SQUOT_STRING? SQUOT_END
+    unquotedString
     ;
 
 unquotedString :