1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.directory.api.ldap.model.schema.syntaxes;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 import org.apache.directory.api.ldap.model.schema.parsers.ParserMonitor;
28
29
30 import java.io.InputStream;
31 import antlr.TokenStreamException;
32 import antlr.TokenStreamIOException;
33 import antlr.TokenStreamRecognitionException;
34 import antlr.CharStreamException;
35 import antlr.CharStreamIOException;
36 import antlr.ANTLRException;
37 import java.io.Reader;
38 import java.util.Hashtable;
39 import antlr.CharScanner;
40 import antlr.InputBuffer;
41 import antlr.ByteBuffer;
42 import antlr.CharBuffer;
43 import antlr.Token;
44 import antlr.CommonToken;
45 import antlr.RecognitionException;
46 import antlr.NoViableAltForCharException;
47 import antlr.MismatchedCharException;
48 import antlr.TokenStream;
49 import antlr.ANTLRHashString;
50 import antlr.LexerSharedInputState;
51 import antlr.collections.impl.BitSet;
52 import antlr.SemanticException;
53
54
55
56
57
58
59 public class AntlrSchemaQdstringLexer extends antlr.CharScanner implements AntlrSchemaQdstringTokenTypes, TokenStream
60 {
61 public AntlrSchemaQdstringLexer(InputStream in) {
62 this(new ByteBuffer(in));
63 }
64 public AntlrSchemaQdstringLexer(Reader in) {
65 this(new CharBuffer(in));
66 }
67 public AntlrSchemaQdstringLexer(InputBuffer ib) {
68 this(new LexerSharedInputState(ib));
69 }
70 public AntlrSchemaQdstringLexer(LexerSharedInputState state) {
71 super(state);
72 caseSensitiveLiterals = true;
73 setCaseSensitive(false);
74 literals = new Hashtable();
75 }
76
77 public Token nextToken() throws TokenStreamException {
78 Token theRetToken=null;
79 tryAgain:
80 for (;;) {
81 Token _token = null;
82 int _ttype = Token.INVALID_TYPE;
83 resetText();
84 try {
85 try {
86 switch ( LA(1)) {
87 case '\t': case '\n': case '\r': case ' ':
88 {
89 mWHSP(true);
90 theRetToken=_returnToken;
91 break;
92 }
93 case '(':
94 {
95 mLPAR(true);
96 theRetToken=_returnToken;
97 break;
98 }
99 case ')':
100 {
101 mRPAR(true);
102 theRetToken=_returnToken;
103 break;
104 }
105 default:
106 if ((LA(1)=='\'') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
107 mQDSTRING(true);
108 theRetToken=_returnToken;
109 }
110 else if ((LA(1)=='\'') && (true)) {
111 mQUOTE(true);
112 theRetToken=_returnToken;
113 }
114 else {
115 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
116 else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
117 }
118 }
119 if ( _returnToken==null ) continue tryAgain;
120 _ttype = _returnToken.getType();
121 _ttype = testLiteralsTable(_ttype);
122 _returnToken.setType(_ttype);
123 return _returnToken;
124 }
125 catch (RecognitionException e) {
126 throw new TokenStreamRecognitionException(e);
127 }
128 }
129 catch (CharStreamException cse) {
130 if ( cse instanceof CharStreamIOException ) {
131 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
132 }
133 else {
134 throw new TokenStreamException(cse.getMessage());
135 }
136 }
137 }
138 }
139
140 public final void mWHSP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
141 int _ttype; Token _token=null; int _begin=text.length();
142 _ttype = WHSP;
143 int _saveIndex;
144
145 {
146 int _cnt4=0;
147 _loop4:
148 do {
149 switch ( LA(1)) {
150 case ' ':
151 {
152 match(' ');
153 break;
154 }
155 case '\t':
156 {
157 match('\t');
158 break;
159 }
160 case '\r':
161 {
162 match('\r');
163 {
164 if ((LA(1)=='\n') && (true)) {
165 match('\n');
166 }
167 else {
168 }
169
170 }
171 newline();
172 break;
173 }
174 case '\n':
175 {
176 match('\n');
177 newline();
178 break;
179 }
180 default:
181 {
182 if ( _cnt4>=1 ) { break _loop4; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
183 }
184 }
185 _cnt4++;
186 } while (true);
187 }
188 _ttype = Token.SKIP;
189 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
190 _token = makeToken(_ttype);
191 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
192 }
193 _returnToken = _token;
194 }
195
196 public final void mLPAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
197 int _ttype; Token _token=null; int _begin=text.length();
198 _ttype = LPAR;
199 int _saveIndex;
200
201 match('(');
202 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
203 _token = makeToken(_ttype);
204 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
205 }
206 _returnToken = _token;
207 }
208
209 public final void mRPAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
210 int _ttype; Token _token=null; int _begin=text.length();
211 _ttype = RPAR;
212 int _saveIndex;
213
214 match(')');
215 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
216 _token = makeToken(_ttype);
217 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
218 }
219 _returnToken = _token;
220 }
221
222 public final void mQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
223 int _ttype; Token _token=null; int _begin=text.length();
224 _ttype = QUOTE;
225 int _saveIndex;
226
227 match('\'');
228 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
229 _token = makeToken(_ttype);
230 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
231 }
232 _returnToken = _token;
233 }
234
235 public final void mQDSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
236 int _ttype; Token _token=null; int _begin=text.length();
237 _ttype = QDSTRING;
238 int _saveIndex;
239
240 {
241 mQUOTE(false);
242 {
243 _loop11:
244 do {
245 if ((_tokenSet_0.member(LA(1)))) {
246 matchNot('\'');
247 }
248 else {
249 break _loop11;
250 }
251
252 } while (true);
253 }
254 mQUOTE(false);
255 }
256 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
257 _token = makeToken(_ttype);
258 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
259 }
260 _returnToken = _token;
261 }
262
263
264 private static final long[] mk_tokenSet_0() {
265 long[] data = new long[2048];
266 data[0]=-549755813889L;
267 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
268 data[1023]=9223372036854775807L;
269 return data;
270 }
271 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
272
273 }