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;
20 SEMICOLON : ';' -> type(SEMICOLON);
21 LEFT_BRACE : '{' -> type(LEFT_BRACE);
22 RIGHT_BRACE : '}' -> type(RIGHT_BRACE);
23 COLON : ':' -> type(COLON);
24 PLUS : '+' -> type(PLUS);
26 LINE_COMMENT : [ \n\r\t]* ('//' (~[\r\n]*)) [ \n\r\t]* -> skip;
27 BLOCK_COMMENT : '/*' .*? '*/' -> skip;
29 SEP: [ \n\r\t]+ -> type(SEP);
30 IDENTIFIER : [a-zA-Z_/][a-zA-Z0-9_\-.:/]* -> type(IDENTIFIER);
32 fragment SUB_STRING : ('"' (ESC | ~["])*? '"') | ('\'' (ESC | ~['])* '\'');
33 fragment ESC : '\\' (["\\/bfnrt] | UNICODE);
34 fragment UNICODE : 'u' HEX HEX HEX HEX;
35 fragment HEX : [0-9a-fA-F] ;
37 STRING: ((~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '"' | '\'' | '}' | '/' | '+')~( '\r' | '\n' | '\t' | ' ' | ';' | '{' | '}' )* ) | SUB_STRING );