📄 javalexer.java
字号:
// $ANTLR 2.7.2: "java.g" -> "JavaLexer.java"$
package org.drools.semantics.java.parser;
import java.io.InputStream;
import java.io.Reader;
import java.util.Hashtable;
import antlr.ANTLRHashString;
import antlr.ByteBuffer;
import antlr.CharBuffer;
import antlr.CharStreamException;
import antlr.CharStreamIOException;
import antlr.InputBuffer;
import antlr.LexerSharedInputState;
import antlr.NoViableAltForCharException;
import antlr.RecognitionException;
import antlr.Token;
import antlr.TokenStream;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.TokenStreamRecognitionException;
import antlr.collections.impl.BitSet;
/**
* Java 1.3 Lexer.
*
* This grammar is in the PUBLIC DOMAIN
*
* @author John Mitchell johnm@non.net
* @author Terence Parr parrt@magelang.com
* @author John Lilley jlilley@empathy.com
* @author Scott Stanchfield thetick@magelang.com
* @author Markus Mohnen mohnen@informatik.rwth-aachen.de
* @author Peter Williams pete.williams@sun.com
* @author Allan Jacobs Allan.Jacobs@eng.sun.com
* @author Steve Messick messick@redhills.com
*
*/
public class JavaLexer extends antlr.CharScanner
implements
JavaTokenTypes,
TokenStream
{
public JavaLexer(InputStream in)
{
this( new ByteBuffer( in ) );
}
public JavaLexer(Reader in)
{
this( new CharBuffer( in ) );
}
public JavaLexer(InputBuffer ib)
{
this( new LexerSharedInputState( ib ) );
}
public JavaLexer(LexerSharedInputState state)
{
super( state );
caseSensitiveLiterals = true;
setCaseSensitive( true );
literals = new Hashtable();
literals.put( new ANTLRHashString( "byte",
this ),
new Integer( 61 ) );
literals.put( new ANTLRHashString( "public",
this ),
new Integer( 71 ) );
literals.put( new ANTLRHashString( "case",
this ),
new Integer( 98 ) );
literals.put( new ANTLRHashString( "short",
this ),
new Integer( 63 ) );
literals.put( new ANTLRHashString( "break",
this ),
new Integer( 93 ) );
literals.put( new ANTLRHashString( "while",
this ),
new Integer( 91 ) );
literals.put( new ANTLRHashString( "new",
this ),
new Integer( 141 ) );
literals.put( new ANTLRHashString( "ruleset",
this ),
new Integer( 44 ) );
literals.put( new ANTLRHashString( "instanceof",
this ),
new Integer( 126 ) );
literals.put( new ANTLRHashString( "implements",
this ),
new Integer( 83 ) );
literals.put( new ANTLRHashString( "then",
this ),
new Integer( 47 ) );
literals.put( new ANTLRHashString( "synchronized",
this ),
new Integer( 77 ) );
literals.put( new ANTLRHashString( "float",
this ),
new Integer( 65 ) );
literals.put( new ANTLRHashString( "package",
this ),
new Integer( 55 ) );
literals.put( new ANTLRHashString( "return",
this ),
new Integer( 95 ) );
literals.put( new ANTLRHashString( "throw",
this ),
new Integer( 97 ) );
literals.put( new ANTLRHashString( "null",
this ),
new Integer( 140 ) );
literals.put( new ANTLRHashString( "threadsafe",
this ),
new Integer( 76 ) );
literals.put( new ANTLRHashString( "protected",
this ),
new Integer( 72 ) );
literals.put( new ANTLRHashString( "when",
this ),
new Integer( 46 ) );
literals.put( new ANTLRHashString( "class",
this ),
new Integer( 79 ) );
literals.put( new ANTLRHashString( "throws",
this ),
new Integer( 86 ) );
literals.put( new ANTLRHashString( "do",
this ),
new Integer( 92 ) );
literals.put( new ANTLRHashString( "strictfp",
this ),
new Integer( 41 ) );
literals.put( new ANTLRHashString( "super",
this ),
new Integer( 85 ) );
literals.put( new ANTLRHashString( "transient",
this ),
new Integer( 74 ) );
literals.put( new ANTLRHashString( "native",
this ),
new Integer( 75 ) );
literals.put( new ANTLRHashString( "interface",
this ),
new Integer( 81 ) );
literals.put( new ANTLRHashString( "final",
this ),
new Integer( 39 ) );
literals.put( new ANTLRHashString( "if",
this ),
new Integer( 88 ) );
literals.put( new ANTLRHashString( "double",
this ),
new Integer( 67 ) );
literals.put( new ANTLRHashString( "volatile",
this ),
new Integer( 78 ) );
literals.put( new ANTLRHashString( "catch",
this ),
new Integer( 102 ) );
literals.put( new ANTLRHashString( "try",
this ),
new Integer( 100 ) );
literals.put( new ANTLRHashString( "int",
this ),
new Integer( 64 ) );
literals.put( new ANTLRHashString( "for",
this ),
new Integer( 90 ) );
literals.put( new ANTLRHashString( "extends",
this ),
new Integer( 80 ) );
literals.put( new ANTLRHashString( "boolean",
this ),
new Integer( 60 ) );
literals.put( new ANTLRHashString( "char",
this ),
new Integer( 62 ) );
literals.put( new ANTLRHashString( "private",
this ),
new Integer( 70 ) );
literals.put( new ANTLRHashString( "default",
this ),
new Integer( 99 ) );
literals.put( new ANTLRHashString( "rule",
this ),
new Integer( 45 ) );
literals.put( new ANTLRHashString( "false",
this ),
new Integer( 139 ) );
literals.put( new ANTLRHashString( "this",
this ),
new Integer( 84 ) );
literals.put( new ANTLRHashString( "static",
this ),
new Integer( 73 ) );
literals.put( new ANTLRHashString( "abstract",
this ),
new Integer( 40 ) );
literals.put( new ANTLRHashString( "continue",
this ),
new Integer( 94 ) );
literals.put( new ANTLRHashString( "finally",
this ),
new Integer( 101 ) );
literals.put( new ANTLRHashString( "else",
this ),
new Integer( 89 ) );
literals.put( new ANTLRHashString( "import",
this ),
new Integer( 56 ) );
literals.put( new ANTLRHashString( "void",
this ),
new Integer( 59 ) );
literals.put( new ANTLRHashString( "switch",
this ),
new Integer( 96 ) );
literals.put( new ANTLRHashString( "true",
this ),
new Integer( 138 ) );
literals.put( new ANTLRHashString( "long",
this ),
new Integer( 66 ) );
}
public Token nextToken() throws TokenStreamException
{
Token theRetToken = null;
tryAgain : for ( ;; )
{
Token _token = null;
int _ttype = Token.INVALID_TYPE;
resetText();
try
{ // for char stream error handling
try
{ // for lexical error handling
switch ( LA( 1 ) )
{
case '?' :
{
mQUESTION( true );
theRetToken = _returnToken;
break;
}
case '(' :
{
mLPAREN( true );
theRetToken = _returnToken;
break;
}
case ')' :
{
mRPAREN( true );
theRetToken = _returnToken;
break;
}
case '[' :
{
mLBRACK( true );
theRetToken = _returnToken;
break;
}
case ']' :
{
mRBRACK( true );
theRetToken = _returnToken;
break;
}
case '{' :
{
mLCURLY( true );
theRetToken = _returnToken;
break;
}
case '}' :
{
mRCURLY( true );
theRetToken = _returnToken;
break;
}
case ':' :
{
mCOLON( true );
theRetToken = _returnToken;
break;
}
case ',' :
{
mCOMMA( true );
theRetToken = _returnToken;
break;
}
case '~' :
{
mBNOT( true );
theRetToken = _returnToken;
break;
}
case ';' :
{
mSEMI( true );
theRetToken = _returnToken;
break;
}
case '\t' :
case '\n' :
case '\u000c' :
case '\r' :
case ' ' :
{
mWS( true );
theRetToken = _returnToken;
break;
}
case '\'' :
{
mCHAR_LITERAL( true );
theRetToken = _returnToken;
break;
}
case '"' :
{
mSTRING_LITERAL( true );
theRetToken = _returnToken;
break;
}
case '$' :
case 'A' :
case 'B' :
case 'C' :
case 'D' :
case 'E' :
case 'F' :
case 'G' :
case 'H' :
case 'I' :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -