Update yang-xpath-antlr a bit
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / antlr4 / org / opendaylight / yangtools / antlrv4 / code / gen / YangStatementLexer.g4
1 //
2 // Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3 //
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
7 //
8 lexer grammar YangStatementLexer;
9
10 tokens {
11     SEMICOLON,
12     LEFT_BRACE,
13     RIGHT_BRACE,
14     SEP,
15     IDENTIFIER,
16     COLON,
17     PLUS
18 }
19
20 SEMICOLON : ';' -> type(SEMICOLON);
21 LEFT_BRACE : '{' -> type(LEFT_BRACE);
22 RIGHT_BRACE : '}' -> type(RIGHT_BRACE);
23 COLON : ':' -> type(COLON);
24 PLUS : '+' -> type(PLUS);
25
26 LINE_COMMENT :  [ \n\r\t]* ('//' (~[\r\n]*)) [ \n\r\t]* -> skip;
27
28 START_BLOCK_COMMENT : '/*' ->pushMode(BLOCK_COMMENT_MODE), skip;
29
30 SEP: [ \n\r\t]+ -> type(SEP);
31 IDENTIFIER : [a-zA-Z_/][a-zA-Z0-9_\-.:/]* -> type(IDENTIFIER);
32
33 fragment SUB_STRING : ('"' (ESC | ~["])*? '"') | ('\'' (ESC | ~['])* '\'');
34 fragment ESC : '\\' (["\\/bfnrt] | UNICODE);
35 fragment UNICODE : 'u' HEX HEX HEX HEX;
36 fragment HEX : [0-9a-fA-F] ;
37
38 STRING: ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '\'' | '}' | '/' | '+')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '}' )* ) | SUB_STRING );
39
40 mode BLOCK_COMMENT_MODE;
41 END_BLOCK_COMMENT : '*/' -> popMode, skip;
42 BLOCK_COMMENT :  . -> skip;