ONOS-6678 YANG Compiler: Comments after module end and {\ to be handled
* add an exclusion of '}' in STRING token
* add a test case which has '}//' token
Change-Id: I4d74a496eeaa9b6d4600f09377ff3b57aaf1d4a5
diff --git a/compiler/base/parser/src/main/resources/YangLexer.g4 b/compiler/base/parser/src/main/resources/YangLexer.g4
index 792a2cb..d020371 100644
--- a/compiler/base/parser/src/main/resources/YangLexer.g4
+++ b/compiler/base/parser/src/main/resources/YangLexer.g4
@@ -126,7 +126,7 @@
WS : [ \r\t\u000C\n]+ -> channel(HIDDEN)
;
LINE_COMMENT
- : '//' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN)
+ : '//' ~[\r\n]* -> channel(HIDDEN)
;
// Additional rules
@@ -144,7 +144,7 @@
UNKNOWN_STATEMENT : IDENTIFIER COLON IDENTIFIER;
- STRING : ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '+' | '\'')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '+')* ) | SUB_STRING );
+ STRING : ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '}' | '"' | '+' | '\'')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '+')* ) | SUB_STRING );
//Fragment rules
fragment SUB_STRING : ('"' (ESC | ~["])*'"') | ('\'' (ESC | ~['])*'\'') ;