Replace block comment with a non-greedy rule
[yangtools.git] / yang / yang-parser-antlr / src / main / antlr4 / org / opendaylight / yangtools / yang / parser / antlr / YangStatementLexer.g4
index 8185545f38b047a9d728420be7ac2c6e0fcf978f..3788c9cf928ff51c5863d8e6a8bf23c7458c80e3 100644 (file)
@@ -23,9 +23,8 @@ RIGHT_BRACE : '}' -> type(RIGHT_BRACE);
 COLON : ':' -> type(COLON);
 PLUS : '+' -> type(PLUS);
 
-LINE_COMMENT :  [ \n\r\t]* ('//' (~[\r\n]*)) [ \n\r\t]* -> skip;
-
-START_BLOCK_COMMENT : '/*' ->pushMode(BLOCK_COMMENT_MODE), skip;
+LINE_COMMENT : [ \n\r\t]* ('//' (~[\r\n]*)) [ \n\r\t]* -> skip;
+BLOCK_COMMENT : '/*' .*? '*/' -> skip;
 
 SEP: [ \n\r\t]+ -> type(SEP);
 IDENTIFIER : [a-zA-Z_/][a-zA-Z0-9_\-.:/]* -> type(IDENTIFIER);
@@ -37,6 +36,3 @@ fragment HEX : [0-9a-fA-F] ;
 
 STRING: ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '\'' | '}' | '/' | '+')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '}' )* ) | SUB_STRING );
 
-mode BLOCK_COMMENT_MODE;
-END_BLOCK_COMMENT : '*/' -> popMode, skip;
-BLOCK_COMMENT :  . -> skip;