1 lexer grammar instanceIdentifierLexer;
4 * YANG 1.1 instance-identifier grammar, as defined in
5 * https://tools.ietf.org/html/rfc7950#section-9.13
7 * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
9 * This program and the accompanying materials are made available under the
10 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11 * and is available at http://www.eclipse.org/legal/epl-v10.html
20 Identifier : [a-zA-Z][a-zA-Z0-9_\-.]*
23 // Note: XPath elements are counted from 1, not from 0, as per
24 // https://mailarchive.ietf.org/arch/msg/netmod/xSR_hu6ry4EWfrvIY5NqcmC7ZoM/
25 PositiveIntegerValue : [1-9][0-9]*
31 // Double/single-quoted strings. We deal with these using specialized modes.
32 DQUOT_START : '"' -> pushMode(DQUOT_STRING_MODE), skip;
33 SQUOT_START : '\'' -> pushMode(SQUOT_STRING_MODE), skip;
36 // Double-quoted string lexing mode. We interpret \n, \t, \", \\ only, as per RFC7950.
38 mode DQUOT_STRING_MODE;
39 DQUOT_STRING : (YANGCHAR | '\'' | ('\\' [nt"\\]))+ ;
40 DQUOT_END : '"' -> popMode;
43 // Single-quoted string lexing mode. We do not interpret anything within single
46 mode SQUOT_STRING_MODE;
47 SQUOT_STRING : (YANGCHAR | '"' | '\\')+ ;
48 SQUOT_END : '\'' -> popMode;
54 // '\u0020'..'\uD7FF' without "'", '"' and '\'
55 | '\u0020'..'\u0021' // 0x22 = "
56 | '\u0023'..'\u0026' // 0x27 = '
57 | '\u0028'..'\u005B' // 0x5C = \
62 | '\u{10000}'..'\u{1FFFD}'
63 | '\u{20000}'..'\u{2FFFD}'
64 | '\u{30000}'..'\u{3FFFD}'
65 | '\u{40000}'..'\u{4FFFD}'
66 | '\u{50000}'..'\u{5FFFD}'
67 | '\u{60000}'..'\u{6FFFD}'
68 | '\u{70000}'..'\u{7FFFD}'
69 | '\u{80000}'..'\u{8FFFD}'
70 | '\u{90000}'..'\u{9FFFD}'
71 | '\u{A0000}'..'\u{AFFFD}'
72 | '\u{B0000}'..'\u{BFFFD}'
73 | '\u{C0000}'..'\u{CFFFD}'
74 | '\u{D0000}'..'\u{DFFFD}'
75 | '\u{E0000}'..'\u{EFFFD}'
76 | '\u{F0000}'..'\u{FFFFD}'
77 | '\u{100000}'..'\u{10FFFD}'