Refactor YANG statement parser structure
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / antlr / org / opendaylight / yangtools / antlrv4 / code / gen / YangStatementParser.g4
index 9f836e2e3210053ccbc39cda5eaccdcfcde9111d..dadf258875e27209d5d4010fb7fabc7b1b78354c 100644 (file)
@@ -11,7 +11,10 @@ options {
     tokenVocab = YangStatementLexer;
 }
 
-statement : SEP* keyword SEP* (argument)? SEP* (SEMICOLON | LEFT_BRACE SEP* (statement)* SEP* RIGHT_BRACE SEP*) SEP*;
+// NOTE: we need to use SEP*/SEP+ because comments end up breaking whitespace
+//       sequences into two.
+file : SEP* statement SEP* EOF;
+statement : keyword (SEP+ argument)? SEP* (SEMICOLON | LEFT_BRACE SEP* (statement SEP*)* RIGHT_BRACE);
 keyword : (IDENTIFIER COLON)? IDENTIFIER;
 
 argument : STRING (SEP* PLUS SEP* STRING)* | IDENTIFIER;