1
// $ANTLR 2.7.5 (20050128): "mapping.g" -> "MappingLexer.java"$
4
* JasperReports - Free Java Reporting Library.
5
* Copyright (C) 2001 - 2009 Jaspersoft Corporation. All rights reserved.
6
* http://www.jaspersoft.com
8
* Unless you have purchased a commercial license agreement from Jaspersoft,
9
* the following license terms apply:
11
* This program is part of JasperReports.
13
* JasperReports is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU Lesser General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
18
* JasperReports is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU Lesser General Public License for more details.
23
* You should have received a copy of the GNU Lesser General Public License
24
* along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
26
package net.sf.jasperreports.olap.mapping;
28
import java.io.InputStream;
29
import java.io.Reader;
30
import java.util.Hashtable;
32
import antlr.ANTLRHashString;
33
import antlr.ByteBuffer;
34
import antlr.CharBuffer;
35
import antlr.CharStreamException;
36
import antlr.CharStreamIOException;
37
import antlr.InputBuffer;
38
import antlr.LexerSharedInputState;
39
import antlr.NoViableAltForCharException;
40
import antlr.RecognitionException;
42
import antlr.TokenStream;
43
import antlr.TokenStreamException;
44
import antlr.TokenStreamIOException;
45
import antlr.TokenStreamRecognitionException;
46
import antlr.collections.impl.BitSet;
49
* @author Lucian Chirita (lucianc@users.sourceforge.net)
50
* @version $Id: MappingLexer.java 3740 2010-04-16 15:03:17Z lucianc $
52
public class MappingLexer extends antlr.CharScanner implements MappingParserTokenTypes, TokenStream
54
public MappingLexer(InputStream in) {
55
this(new ByteBuffer(in));
57
public MappingLexer(Reader in) {
58
this(new CharBuffer(in));
60
public MappingLexer(InputBuffer ib) {
61
this(new LexerSharedInputState(ib));
63
public MappingLexer(LexerSharedInputState state) {
65
caseSensitiveLiterals = true;
66
setCaseSensitive(false);
67
literals = new Hashtable();
68
literals.put(new ANTLRHashString("Columns", this), Integer.valueOf(7));
69
literals.put(new ANTLRHashString("Data", this), Integer.valueOf(12));
70
literals.put(new ANTLRHashString("Chapters", this), Integer.valueOf(10));
71
literals.put(new ANTLRHashString("Rows", this), Integer.valueOf(8));
72
literals.put(new ANTLRHashString("Sections", this), Integer.valueOf(11));
73
literals.put(new ANTLRHashString("FormattedData", this), Integer.valueOf(13));
74
literals.put(new ANTLRHashString("Axis", this), Integer.valueOf(4));
75
literals.put(new ANTLRHashString("Pages", this), Integer.valueOf(9));
78
public Token nextToken() throws TokenStreamException {
79
Token theRetToken=null;
83
int _ttype = Token.INVALID_TYPE;
85
try { // for char stream error handling
86
try { // for lexical error handling
91
theRetToken=_returnToken;
97
theRetToken=_returnToken;
103
theRetToken=_returnToken;
109
theRetToken=_returnToken;
115
theRetToken=_returnToken;
121
theRetToken=_returnToken;
127
theRetToken=_returnToken;
133
theRetToken=_returnToken;
136
case '0': case '1': case '2': case '3':
137
case '4': case '5': case '6': case '7':
141
theRetToken=_returnToken;
147
theRetToken=_returnToken;
150
case '\t': case '\n': case '\r': case ' ':
153
theRetToken=_returnToken;
157
if ((_tokenSet_0.member(LA(1)))) {
159
theRetToken=_returnToken;
162
if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
163
else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
166
if ( _returnToken==null )
168
continue tryAgain; // found SKIP token
170
_ttype = _returnToken.getType();
171
_ttype = testLiteralsTable(_ttype);
172
_returnToken.setType(_ttype);
175
catch (RecognitionException e) {
176
throw new TokenStreamRecognitionException(e);
179
catch (CharStreamException cse) {
180
if ( cse instanceof CharStreamIOException ) {
181
throw new TokenStreamIOException(((CharStreamIOException)cse).io);
184
throw new TokenStreamException(cse.getMessage());
190
public final void mPOINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
191
int _ttype; Token _token=null; int _begin=text.length();
196
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
197
_token = makeToken(_ttype);
198
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
200
_returnToken = _token;
203
public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
204
int _ttype; Token _token=null; int _begin=text.length();
209
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
210
_token = makeToken(_ttype);
211
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
213
_returnToken = _token;
216
public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
217
int _ttype; Token _token=null; int _begin=text.length();
222
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
223
_token = makeToken(_ttype);
224
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
226
_returnToken = _token;
229
public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
230
int _ttype; Token _token=null; int _begin=text.length();
235
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
236
_token = makeToken(_ttype);
237
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
239
_returnToken = _token;
242
public final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
243
int _ttype; Token _token=null; int _begin=text.length();
248
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
249
_token = makeToken(_ttype);
250
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
252
_returnToken = _token;
255
public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
256
int _ttype; Token _token=null; int _begin=text.length();
261
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
262
_token = makeToken(_ttype);
263
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
265
_returnToken = _token;
268
public final void mQMARK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
269
int _ttype; Token _token=null; int _begin=text.length();
274
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
275
_token = makeToken(_ttype);
276
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
278
_returnToken = _token;
281
public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
282
int _ttype; Token _token=null; int _begin=text.length();
287
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
288
_token = makeToken(_ttype);
289
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
291
_returnToken = _token;
294
public final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
295
int _ttype; Token _token=null; int _begin=text.length();
303
if (((LA(1) >= '0' && LA(1) <= '9'))) {
307
if ( _cnt50>=1 ) { break _loop50; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
313
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
314
_token = makeToken(_ttype);
315
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
317
_returnToken = _token;
320
protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
321
int _ttype; Token _token=null; int _begin=text.length();
326
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
327
_token = makeToken(_ttype);
328
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
330
_returnToken = _token;
333
public final void mMONDRNAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
334
int _ttype; Token _token=null; int _begin=text.length();
343
if ((_tokenSet_1.member(LA(1)))) {
349
if ( _cnt54>=1 ) { break _loop54; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
356
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
357
_token = makeToken(_ttype);
358
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
360
_returnToken = _token;
363
public final void mNAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
364
int _ttype; Token _token=null; int _begin=text.length();
373
case '0': case '1': case '2': case '3':
374
case '4': case '5': case '6': case '7':
386
if ((_tokenSet_0.member(LA(1)))) {
395
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
396
_token = makeToken(_ttype);
397
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
399
_returnToken = _token;
402
protected final void mLETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
403
int _ttype; Token _token=null; int _begin=text.length();
407
if (((LA(1) >= 'a' && LA(1) <= 'z'))) {
410
else if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) {
411
matchRange('\u0080','\ufffe');
414
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
417
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
418
_token = makeToken(_ttype);
419
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
421
_returnToken = _token;
424
public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
425
int _ttype; Token _token=null; int _begin=text.length();
454
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
459
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
460
_token = makeToken(_ttype);
461
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
463
_returnToken = _token;
467
private static final long[] mk_tokenSet_0() {
468
long[] data = new long[3072];
469
data[1]=576460743713488896L;
470
for (int i = 2; i<=1022; i++) { data[i]=-1L; }
471
data[1023]=9223372036854775807L;
474
public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
475
private static final long[] mk_tokenSet_1() {
476
long[] data = new long[2048];
479
for (int i = 2; i<=1022; i++) { data[i]=-1L; }
480
data[1023]=9223372036854775807L;
483
public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());