2 // Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 // and is available at http://www.eclipse.org/legal/epl-v10.html
8 lexer grammar YangStatementLexer;
11 package org.opendaylight.yangtools.antlrv4.code.gen;
24 SEMICOLON : ';' -> type(SEMICOLON);
25 LEFT_BRACE : '{' -> type(LEFT_BRACE);
26 RIGHT_BRACE : '}' -> type(RIGHT_BRACE);
27 COLON : ':' -> type(COLON);
28 PLUS : '+' -> type(PLUS);
30 LINE_COMMENT : [ \n\r\t]* ('//' (~[\r\n]*)) [ \n\r\t]* -> skip;
32 START_BLOCK_COMMENT : '/*' ->pushMode(BLOCK_COMMENT_MODE), skip;
34 SEP: [ \n\r\t]+ -> type(SEP);
35 IDENTIFIER : [a-zA-Z_/][a-zA-Z0-9_\-.:/]* -> type(IDENTIFIER);
37 fragment SUB_STRING : ('"' (ESC | ~["])*'"') | ('\'' (ESC | ~['])*'\'');
38 fragment ESC : '\\' (["\\/bfnrt] | UNICODE);
39 fragment UNICODE : 'u' HEX HEX HEX HEX;
40 fragment HEX : [0-9a-fA-F] ;
42 STRING : ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '\'' | ':' | '/' | '=' | '[' | ']' )~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | ':' | '/' | '=' | '[' | ']')* ) | SUB_STRING );
44 mode BLOCK_COMMENT_MODE;
45 END_BLOCK_COMMENT : '*/' -> popMode, skip;
46 BLOCK_COMMENT : . -> more, skip;