001// $ANTLR 2.7.7 (20060906): "java14textblocks.g" -> "GeneratedTextBlockLexer.java"$
002
003package com.puppycrawl.tools.checkstyle.grammar;
004
005import com.puppycrawl.tools.checkstyle.DetailAstImpl;
006import java.text.MessageFormat;
007import antlr.CommonHiddenStreamToken;
008import antlr.TokenStreamSelector;
009
010import java.io.InputStream;
011import antlr.TokenStreamException;
012import antlr.TokenStreamIOException;
013import antlr.TokenStreamRecognitionException;
014import antlr.CharStreamException;
015import antlr.CharStreamIOException;
016import antlr.ANTLRException;
017import java.io.Reader;
018import java.util.Hashtable;
019import antlr.CharScanner;
020import antlr.InputBuffer;
021import antlr.ByteBuffer;
022import antlr.CharBuffer;
023import antlr.Token;
024import antlr.CommonToken;
025import antlr.RecognitionException;
026import antlr.NoViableAltForCharException;
027import antlr.MismatchedCharException;
028import antlr.TokenStream;
029import antlr.ANTLRHashString;
030import antlr.LexerSharedInputState;
031import antlr.collections.impl.BitSet;
032import antlr.SemanticException;
033
034public class GeneratedTextBlockLexer extends antlr.CharScanner implements GeneratedTextBlockLexerTokenTypes, TokenStream
035 {
036
037    public TokenStreamSelector selector;
038
039    // explicitly set tab width to 1 (default in ANTLR 2.7.1)
040    // in ANTLR 2.7.2a2 the default has changed from 1 to 8
041    public void tab()
042    {
043        setColumn( getColumn() + 1 );
044    }
045public GeneratedTextBlockLexer(InputStream in) {
046        this(new ByteBuffer(in));
047}
048public GeneratedTextBlockLexer(Reader in) {
049        this(new CharBuffer(in));
050}
051public GeneratedTextBlockLexer(InputBuffer ib) {
052        this(new LexerSharedInputState(ib));
053}
054public GeneratedTextBlockLexer(LexerSharedInputState state) {
055        super(state);
056        caseSensitiveLiterals = true;
057        setCaseSensitive(true);
058        literals = new Hashtable();
059        literals.put(new ANTLRHashString("byte", this), new Integer(51));
060        literals.put(new ANTLRHashString("public", this), new Integer(62));
061        literals.put(new ANTLRHashString("case", this), new Integer(93));
062        literals.put(new ANTLRHashString("short", this), new Integer(53));
063        literals.put(new ANTLRHashString("break", this), new Integer(86));
064        literals.put(new ANTLRHashString("while", this), new Integer(84));
065        literals.put(new ANTLRHashString("new", this), new Integer(136));
066        literals.put(new ANTLRHashString("sealed", this), new Integer(210));
067        literals.put(new ANTLRHashString("instanceof", this), new Integer(121));
068        literals.put(new ANTLRHashString("implements", this), new Integer(75));
069        literals.put(new ANTLRHashString("synchronized", this), new Integer(67));
070        literals.put(new ANTLRHashString("float", this), new Integer(55));
071        literals.put(new ANTLRHashString("package", this), new Integer(44));
072        literals.put(new ANTLRHashString("return", this), new Integer(88));
073        literals.put(new ANTLRHashString("throw", this), new Integer(90));
074        literals.put(new ANTLRHashString("non-sealed", this), new Integer(209));
075        literals.put(new ANTLRHashString("null", this), new Integer(135));
076        literals.put(new ANTLRHashString("protected", this), new Integer(63));
077        literals.put(new ANTLRHashString("class", this), new Integer(69));
078        literals.put(new ANTLRHashString("throws", this), new Integer(81));
079        literals.put(new ANTLRHashString("do", this), new Integer(85));
080        literals.put(new ANTLRHashString("strictfp", this), new Integer(41));
081        literals.put(new ANTLRHashString("super", this), new Integer(79));
082        literals.put(new ANTLRHashString("transient", this), new Integer(65));
083        literals.put(new ANTLRHashString("permits", this), new Integer(211));
084        literals.put(new ANTLRHashString("native", this), new Integer(66));
085        literals.put(new ANTLRHashString("interface", this), new Integer(71));
086        literals.put(new ANTLRHashString("final", this), new Integer(39));
087        literals.put(new ANTLRHashString("yield", this), new Integer(207));
088        literals.put(new ANTLRHashString("if", this), new Integer(83));
089        literals.put(new ANTLRHashString("record", this), new Integer(200));
090        literals.put(new ANTLRHashString("double", this), new Integer(57));
091        literals.put(new ANTLRHashString("volatile", this), new Integer(68));
092        literals.put(new ANTLRHashString("catch", this), new Integer(96));
093        literals.put(new ANTLRHashString("try", this), new Integer(95));
094        literals.put(new ANTLRHashString("int", this), new Integer(54));
095        literals.put(new ANTLRHashString("for", this), new Integer(91));
096        literals.put(new ANTLRHashString("extends", this), new Integer(70));
097        literals.put(new ANTLRHashString("boolean", this), new Integer(50));
098        literals.put(new ANTLRHashString("char", this), new Integer(52));
099        literals.put(new ANTLRHashString("private", this), new Integer(61));
100        literals.put(new ANTLRHashString("default", this), new Integer(94));
101        literals.put(new ANTLRHashString("non", this), new Integer(213));
102        literals.put(new ANTLRHashString("false", this), new Integer(134));
103        literals.put(new ANTLRHashString("this", this), new Integer(78));
104        literals.put(new ANTLRHashString("static", this), new Integer(64));
105        literals.put(new ANTLRHashString("abstract", this), new Integer(40));
106        literals.put(new ANTLRHashString("continue", this), new Integer(87));
107        literals.put(new ANTLRHashString("finally", this), new Integer(97));
108        literals.put(new ANTLRHashString("else", this), new Integer(92));
109        literals.put(new ANTLRHashString("import", this), new Integer(46));
110        literals.put(new ANTLRHashString("void", this), new Integer(49));
111        literals.put(new ANTLRHashString("switch", this), new Integer(89));
112        literals.put(new ANTLRHashString("true", this), new Integer(133));
113        literals.put(new ANTLRHashString("long", this), new Integer(56));
114}
115
116public Token nextToken() throws TokenStreamException {
117        Token theRetToken=null;
118tryAgain:
119        for (;;) {
120                Token _token = null;
121                int _ttype = Token.INVALID_TYPE;
122                setCommitToPath(false);
123                resetText();
124                try {   // for char stream error handling
125                        try {   // for lexical error handling
126                                if ((LA(1)=='"') && (LA(2)=='"')) {
127                                        mTEXT_BLOCK_LITERAL_END(true);
128                                        theRetToken=_returnToken;
129                                }
130                                else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe')) && (true)) {
131                                        mTEXT_BLOCK_CONTENT(true);
132                                        theRetToken=_returnToken;
133                                }
134                                else {
135                                        if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
136                                else {consume(); continue tryAgain;}
137                                }
138                                
139                                if ( _returnToken==null ) continue tryAgain; // found SKIP token
140                                _ttype = _returnToken.getType();
141                                _ttype = testLiteralsTable(_ttype);
142                                _returnToken.setType(_ttype);
143                                return _returnToken;
144                        }
145                        catch (RecognitionException e) {
146                                if ( !getCommitToPath() ) {consume(); continue tryAgain;}
147                                throw new TokenStreamRecognitionException(e);
148                        }
149                }
150                catch (CharStreamException cse) {
151                        if ( cse instanceof CharStreamIOException ) {
152                                throw new TokenStreamIOException(((CharStreamIOException)cse).io);
153                        }
154                        else {
155                                throw new TokenStreamException(cse.getMessage());
156                        }
157                }
158        }
159}
160
161        protected final void mNEWLINE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
162                int _ttype; Token _token=null; int _begin=text.length();
163                _ttype = NEWLINE;
164                int _saveIndex;
165                
166                {
167                if ((LA(1)=='\r') && (LA(2)=='\n')) {
168                        match("\r\n");
169                }
170                else if ((LA(1)=='\r') && (true)) {
171                        match('\r');
172                }
173                else if ((LA(1)=='\n')) {
174                        match('\n');
175                }
176                else {
177                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
178                }
179                
180                }
181                if ( inputState.guessing==0 ) {
182                        this.newline();
183                }
184                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
185                        _token = makeToken(_ttype);
186                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
187                }
188                _returnToken = _token;
189        }
190        
191        public final void mTEXT_BLOCK_LITERAL_END(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
192                int _ttype; Token _token=null; int _begin=text.length();
193                _ttype = TEXT_BLOCK_LITERAL_END;
194                int _saveIndex;
195                
196                match("\"\"\"");
197                if ( inputState.guessing==0 ) {
198                        selector.pop();
199                }
200                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
201                        _token = makeToken(_ttype);
202                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
203                }
204                _returnToken = _token;
205        }
206        
207        protected final void mTWO_DOUBLE_QUOTES(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
208                int _ttype; Token _token=null; int _begin=text.length();
209                _ttype = TWO_DOUBLE_QUOTES;
210                int _saveIndex;
211                
212                match('"');
213                match('"');
214                {
215                if ((LA(1)=='\n'||LA(1)=='\r')) {
216                        mNEWLINE(false);
217                }
218                else if ((_tokenSet_0.member(LA(1)))) {
219                        matchNot('"');
220                }
221                else {
222                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
223                }
224                
225                }
226                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
227                        _token = makeToken(_ttype);
228                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
229                }
230                _returnToken = _token;
231        }
232        
233        protected final void mONE_DOUBLE_QUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
234                int _ttype; Token _token=null; int _begin=text.length();
235                _ttype = ONE_DOUBLE_QUOTE;
236                int _saveIndex;
237                
238                match('"');
239                {
240                if ((LA(1)=='\n'||LA(1)=='\r')) {
241                        mNEWLINE(false);
242                }
243                else if ((_tokenSet_0.member(LA(1)))) {
244                        matchNot('"');
245                }
246                else {
247                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
248                }
249                
250                }
251                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
252                        _token = makeToken(_ttype);
253                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
254                }
255                _returnToken = _token;
256        }
257        
258        public final void mTEXT_BLOCK_CONTENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
259                int _ttype; Token _token=null; int _begin=text.length();
260                _ttype = TEXT_BLOCK_CONTENT;
261                int _saveIndex;
262                
263                {
264                int _cnt12=0;
265                _loop12:
266                do {
267                        boolean synPredMatched11 = false;
268                        if (((LA(1)=='"') && (LA(2)=='"'))) {
269                                int _m11 = mark();
270                                synPredMatched11 = true;
271                                inputState.guessing++;
272                                try {
273                                        {
274                                        mTWO_DOUBLE_QUOTES(false);
275                                        }
276                                }
277                                catch (RecognitionException pe) {
278                                        synPredMatched11 = false;
279                                }
280                                rewind(_m11);
281inputState.guessing--;
282                        }
283                        if ( synPredMatched11 ) {
284                                mTWO_DOUBLE_QUOTES(false);
285                        }
286                        else if ((LA(1)=='"') && (_tokenSet_1.member(LA(2)))) {
287                                mONE_DOUBLE_QUOTE(false);
288                        }
289                        else if ((LA(1)=='\\') && (_tokenSet_2.member(LA(2)))) {
290                                mSTD_ESC(false);
291                        }
292                        else if ((LA(1)=='\n'||LA(1)=='\r')) {
293                                mNEWLINE(false);
294                        }
295                        else if ((_tokenSet_0.member(LA(1))) && (true)) {
296                                matchNot('"');
297                        }
298                        else {
299                                if ( _cnt12>=1 ) { break _loop12; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
300                        }
301                        
302                        _cnt12++;
303                } while (true);
304                }
305                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
306                        _token = makeToken(_ttype);
307                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
308                }
309                _returnToken = _token;
310        }
311        
312        protected final void mSTD_ESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
313                int _ttype; Token _token=null; int _begin=text.length();
314                _ttype = STD_ESC;
315                int _saveIndex;
316                
317                match('\\');
318                {
319                switch ( LA(1)) {
320                case 'n':
321                {
322                        match('n');
323                        break;
324                }
325                case 'r':
326                {
327                        match('r');
328                        break;
329                }
330                case 's':
331                {
332                        match('s');
333                        break;
334                }
335                case 't':
336                {
337                        match('t');
338                        break;
339                }
340                case 'b':
341                {
342                        match('b');
343                        break;
344                }
345                case 'f':
346                {
347                        match('f');
348                        break;
349                }
350                case '"':
351                {
352                        match('"');
353                        break;
354                }
355                case '\'':
356                {
357                        match('\'');
358                        break;
359                }
360                case '\\':
361                {
362                        match('\\');
363                        break;
364                }
365                default:
366                {
367                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
368                }
369                }
370                }
371                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
372                        _token = makeToken(_ttype);
373                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
374                }
375                _returnToken = _token;
376        }
377        
378        
379        private static final long[] mk_tokenSet_0() {
380                long[] data = new long[2048];
381                data[0]=-17179878401L;
382                for (int i = 1; i<=1022; i++) { data[i]=-1L; }
383                data[1023]=9223372036854775807L;
384                return data;
385        }
386        public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
387        private static final long[] mk_tokenSet_1() {
388                long[] data = new long[2048];
389                data[0]=-17179869185L;
390                for (int i = 1; i<=1022; i++) { data[i]=-1L; }
391                data[1023]=9223372036854775807L;
392                return data;
393        }
394        public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
395        private static final long[] mk_tokenSet_2() {
396                long[] data = new long[1025];
397                data[0]=566935683072L;
398                data[1]=7951960418287616L;
399                return data;
400        }
401        public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
402        
403        }