Rework keyword parser rule
[yangtools.git] / yang / yang-parser-antlr / src / main / antlr4 / org / opendaylight / yangtools / yang / parser / antlr / YangStatementParser.g4
index 9f836e2e3210053ccbc39cda5eaccdcfcde9111d..1d7554bf781b553beeff994d68a8d941788d8f84 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*;
-keyword : (IDENTIFIER COLON)? IDENTIFIER;
+// 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;