1 // Generated from XPathLexer.g4 by ANTLR 4.8
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.8", RuntimeMetaData.VERSION); }
24 
25     protected static DFA[] _decisionToDFA;
26     protected PredictionContextCache _sharedContextCache =
27         new PredictionContextCache();
28     public static immutable 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         for (int i = 0; i < tokenNames.length; i++) {
60             tokenNames[i] = VOCABULARY.getLiteralName(i);
61                 if (tokenNames[i] is null) {
62                     tokenNames[i] = VOCABULARY.getSymbolicName(i);
63             }
64             if (tokenNames[i] is null)
65             {
66                 tokenNames[i] = "<INVALID>";
67             }
68         }
69     }
70 
71     override public string[] getTokenNames() {
72         return tokenNames;
73     }
74 
75     override public Vocabulary getVocabulary() {
76         return VOCABULARY;
77     }
78 
79 
80     public this(CharStream input) {
81         super(input);
82         _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
83     }
84 
85     override
86     public string getGrammarFileName() { return "XPathLexer.g4"; }
87 
88     override
89     public string[] getRuleNames() { return ruleNames; }
90 
91     override
92     public wstring getSerializedATN() { return _serializedATN; }
93 
94         override
95     public string[] getChannelNames() { return channelNames; }
96 
97     override
98     public string[] getModeNames() { return modeNames; }
99 
100     override
101     public ATNType getATN() { return _ATN; }
102 
103     override
104     public void action(InterfaceRuleContext _localctx, int ruleIndex, int actionIndex) {
105         switch (ruleIndex) {
106         case 4:
107             ID_action(cast(InterfaceRuleContext)_localctx, actionIndex);
108             break;
109             default: {}
110         }
111     }
112     private void ID_action(InterfaceRuleContext _localctx, int actionIndex) {
113         switch (actionIndex) {
114         case 0:
115 
116                            import std.ascii : isUpper;
117                            import std.conv : to;
118 
119                            string text = to!string(getText);
120             	       if (isUpper(text[0])) setType(TOKEN_REF);
121             	       else setType(RULE_REF);
122             	       
123             break;
124             default: {}
125         }
126     }
127 
128     public static immutable wstring _serializedATN =
129         "\x03\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\x02\n4\b\x01"~
130     	"\x04\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t"~
131     	"\x06\x04\x07\t\x07\x04\b\t\b\x04\t\t\t\x03\x02\x03\x02\x03\x02\x03"~
132     	"\x03\x03\x03\x03\x04\x03\x04\x03\x05\x03\x05\x03\x06\x03\x06\x07\x06"~
133     	"\x1f\n\x06\f\x06\x0e\x06\"\x0b\x06\x03\x06\x03\x06\x03\x07\x03\x07"~
134     	"\x05\x07(\n\x07\x03\b\x03\b\x03\t\x03\t\x07\t.\n\t\f\t\x0e\t1\x0b\t"~
135     	"\x03\t\x03\t\x03/\x02\n\x03\x05\x05\x06\x07\x07\t\b\x0b\t\r\x02\x0f"~
136     	"\x02\x11\n\x03\x02\x04\x07\x022;aa\u00b9\u00b9\u0302\u0371\u2041\u2042"~
137     	"\x0f\x02C\\c|\u00c2\u00d8\u00da\u00f8\u00fa\u0301\u0372\u037f\u0381"~
138     	"\u2001\u200e\u200f\u2072\u2191\u2c02\u2ff1\u3003[154001]\uf902\ufdd1"~
139     	"\ufdf2\uffff\x024\x02\x03\x03\x02\x02\x02\x02\x05\x03\x02\x02\x02\x02"~
140     	"\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02\x02\x0b\x03\x02\x02\x02"~
141     	"\x02\x11\x03\x02\x02\x02\x03\x13\x03\x02\x02\x02\x05\x16\x03\x02\x02"~
142     	"\x02\x07\x18\x03\x02\x02\x02\t\x1a\x03\x02\x02\x02\x0b\x1c\x03\x02"~
143     	"\x02\x02\r\'\x03\x02\x02\x02\x0f)\x03\x02\x02\x02\x11+\x03\x02\x02"~
144     	"\x02\x13\x14\x071\x02\x02\x14\x15\x071\x02\x02\x15\x04\x03\x02\x02"~
145     	"\x02\x16\x17\x071\x02\x02\x17\x06\x03\x02\x02\x02\x18\x19\x07,\x02"~
146     	"\x02\x19\b\x03\x02\x02\x02\x1a\x1b\x07#\x02\x02\x1b\n\x03\x02\x02\x02"~
147     	"\x1c \x05\x0f\b\x02\x1d\x1f\x05\r\x07\x02\x1e\x1d\x03\x02\x02\x02\x1f"~
148     	"\"\x03\x02\x02\x02 \x1e\x03\x02\x02\x02 !\x03\x02\x02\x02!#\x03\x02"~
149     	"\x02\x02\" \x03\x02\x02\x02#$\b\x06\x02\x02$\f\x03\x02\x02\x02%(\x05"~
150     	"\x0f\b\x02&(\t\x02\x02\x02\'%\x03\x02\x02\x02\'&\x03\x02\x02\x02(\x0e"~
151     	"\x03\x02\x02\x02)*\t\x03\x02\x02*\x10\x03\x02\x02\x02+/\x07)\x02\x02"~
152     	",.\x0b\x02\x02\x02-,\x03\x02\x02\x02.1\x03\x02\x02\x02/0\x03\x02\x02"~
153     	"\x02/-\x03\x02\x02\x0202\x03\x02\x02\x021/\x03\x02\x02\x0223\x07)\x02"~
154     	"\x023\x12\x03\x02\x02\x02\x06\x02 \'/\x03\x03\x06\x02";
155     public static ATNType _ATN;
156 
157     static this() {
158         auto atnDeserializer = new ATNDeserializer;
159         _ATN = atnDeserializer.deserialize(_serializedATN);
160         _decisionToDFA.length = 0;
161         for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
162             _decisionToDFA ~= new DFA(_ATN.getDecisionState(i), i);
163         }
164     }
165 }