1 // Generated from XPathLexer.g4 by ANTLR 4.9.2
2 module antlr.v4.runtime.tree.xpath.XPathLexer;
3 
4 import antlr.v4.runtime.Lexer;
5 import antlr.v4.runtime.CharStream;
6 import antlr.v4.runtime.InterfaceRuleContext;
7 import antlr.v4.runtime.RuleContext;
8 import antlr.v4.runtime.RuntimeMetaData;
9 import antlr.v4.runtime.Token;
10 import antlr.v4.runtime.TokenStream;
11 import antlr.v4.runtime.Vocabulary;
12 import antlr.v4.runtime.VocabularyImpl;
13 import antlr.v4.runtime.atn.ATN : ATN;
14 alias ATNType = ATN;
15 import antlr.v4.runtime.atn.PredictionContextCache;
16 import antlr.v4.runtime.atn.ATNDeserializer;
17 import antlr.v4.runtime.atn.LexerATNSimulator;
18 import antlr.v4.runtime.dfa.DFA;
19 import antlr.v4.runtime.LexerNoViableAltException;
20 
21 public class XPathLexer : Lexer {
22     alias recover = Lexer.recover;
23     static this() { RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); }
24 
25     protected static DFA[] _decisionToDFA;
26     protected PredictionContextCache _sharedContextCache =
27         new PredictionContextCache();
28     public enum int
29         TOKEN_REF=1,RULE_REF=2,ANYWHERE=3,ROOT=4,WILDCARD=5,BANG=6,ID=7,
30         STRING=8;
31     public static string[] channelNames = [
32         "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
33     ];
34     public static string[] modeNames = [
35         "DEFAULT_MODE"
36     ];
37 
38     public static string[] ruleNames = [
39         "ANYWHERE","ROOT","WILDCARD","BANG","ID","NameChar","NameStartChar",
40         "STRING"
41     ];
42 
43     private static const string[] _LITERAL_NAMES = [
44         null,null,null,"'//'","'/'","'*'","'!'"
45     ];
46     private static const string[] _SYMBOLIC_NAMES = [
47         null,"TOKEN_REF","RULE_REF","ANYWHERE","ROOT","WILDCARD","BANG",
48         "ID","STRING"
49     ];
50     public static Vocabulary VOCABULARY;
51 
52     /**
53      * @deprecated Use {@link #VOCABULARY} instead.
54      */
55     public static string[_SYMBOLIC_NAMES.length] tokenNames;
56 
57     static this() {
58         VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
59         int index = 0;
60         foreach (ref tokenName; tokenNames)
61             {
62                 tokenName = VOCABULARY.getLiteralName(index);
63                     if (!tokenName) {
64                         tokenName = VOCABULARY.getSymbolicName(index);
65                 }
66                 if (!tokenName)
67                 {
68                     tokenName = "<INVALID>";
69                 }
70             }
71             ++index;
72     }
73 
74     override public string[] getTokenNames() {
75         return tokenNames;
76     }
77 
78     override public Vocabulary getVocabulary() {
79         return VOCABULARY;
80     }
81 
82 
83     public this(CharStream input) {
84         super(input);
85         _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
86     }
87 
88     override
89     public string getGrammarFileName() { return "XPathLexer.g4"; }
90 
91     override
92     public string[] getRuleNames() { return ruleNames; }
93 
94     override
95     public wstring getSerializedATN() { return _serializedATN; }
96 
97         override
98     public string[] getChannelNames() { return channelNames; }
99 
100     override
101     public string[] getModeNames() { return modeNames; }
102 
103     override
104     public ATNType getATN() { return _ATN; }
105 
106     override
107     public void action(InterfaceRuleContext _localctx, int ruleIndex, int actionIndex) {
108         switch (ruleIndex) {
109         case 4:
110             ID_action(cast(InterfaceRuleContext)_localctx, actionIndex);
111             break;
112             default: {}
113         }
114     }
115     private void ID_action(InterfaceRuleContext _localctx, int actionIndex) {
116         switch (actionIndex) {
117         case 0:
118 
119                            import std.ascii : isUpper;
120                            import std.conv : to;
121 
122                            string text = to!string(getText);
123             	       if (isUpper(text[0])) setType(TOKEN_REF);
124             	       else setType(RULE_REF);
125             	       
126             break;
127             default: {}
128         }
129     }
130 
131     public static immutable wstring _serializedATN =
132         "\x03\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\x02\n4\b\x01"~
133     	"\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t"~
134     	"\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x03\x02\x03\x02\x03\x02\x03"~
135     	"\x03\x03\x03\x03\x04\x03\x04\x03\x05\x03\x05\x03\x06\x03\x06\x07\x06"~
136     	"\x1f\n\x06\f\x06\x0e\x06\"\x0b\x06\x03\x06\x03\x06\x03\x07\x03\x07"~
137     	"\x05\x07(\n\x07\x03\b\x03\b\x03\t\x03\t\x07\t.\n\t\f\t\x0e\t1\x0b\t"~
138     	"\x03\t\x03\t\x03/\x02\n\x03\x05\x05\x06\x07\x07\t\b\x0b\t\r\x02\x0f"~
139     	"\x02\x11\n\x03\x02\x04\x07\x022;aa\u00b9\u00b9\u0302\u0371\u2041\u2042"~
140     	"\x0f\x02C\\c|\u00c2\u00d8\u00da\u00f8\u00fa\u0301\u0372\u037f\u0381"~
141     	"\u2001\u200e\u200f\u2072\u2191\u2c02\u2ff1\u3003[154001]\uf902\ufdd1"~
142     	"\ufdf2\uffff\x024\x02\x03\x03\x02\x02\x02\x02\x05\x03\x02\x02\x02\x02"~
143     	"\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02\x02\x0b\x03\x02\x02\x02"~
144     	"\x02\x11\x03\x02\x02\x02\x03\x13\x03\x02\x02\x02\x05\x16\x03\x02\x02"~
145     	"\x02\x07\x18\x03\x02\x02\x02\t\x1a\x03\x02\x02\x02\x0b\x1c\x03\x02"~
146     	"\x02\x02\r\'\x03\x02\x02\x02\x0f)\x03\x02\x02\x02\x11+\x03\x02\x02"~
147     	"\x02\x13\x14\x071\x02\x02\x14\x15\x071\x02\x02\x15\x04\x03\x02\x02"~
148     	"\x02\x16\x17\x071\x02\x02\x17\x06\x03\x02\x02\x02\x18\x19\x07,\x02"~
149     	"\x02\x19\b\x03\x02\x02\x02\x1a\x1b\x07#\x02\x02\x1b\n\x03\x02\x02\x02"~
150     	"\x1c \x05\x0f\b\x02\x1d\x1f\x05\r\x07\x02\x1e\x1d\x03\x02\x02\x02\x1f"~
151     	"\"\x03\x02\x02\x02 \x1e\x03\x02\x02\x02 !\x03\x02\x02\x02!#\x03\x02"~
152     	"\x02\x02\" \x03\x02\x02\x02#$\b\x06\x02\x02$\f\x03\x02\x02\x02%(\x05"~
153     	"\x0f\b\x02&(\t\x02\x02\x02\'%\x03\x02\x02\x02\'&\x03\x02\x02\x02(\x0e"~
154     	"\x03\x02\x02\x02)*\t\x03\x02\x02*\x10\x03\x02\x02\x02+/\x07)\x02\x02"~
155     	",.\x0b\x02\x02\x02-,\x03\x02\x02\x02.1\x03\x02\x02\x02/0\x03\x02\x02"~
156     	"\x02/-\x03\x02\x02\x0202\x03\x02\x02\x021/\x03\x02\x02\x0223\x07)\x02"~
157     	"\x023\x12\x03\x02\x02\x02\x06\x02 \'/\x03\x03\x06\x02";
158     public static ATNType _ATN;
159 
160     static this() {
161         auto atnDeserializer = new ATNDeserializer;
162         _ATN = atnDeserializer.deserialize(_serializedATN);
163         _decisionToDFA.length = 0;
164         for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
165             _decisionToDFA ~= new DFA(_ATN.getDecisionState(i), i);
166         }
167     }
168 }