📄 javatreeparser.java
字号:
// $ANTLR 2.7.2: "java.tree.g" -> "JavaTreeParser.java"$
package org.drools.semantics.java.parser;
import java.util.ArrayList;
import java.util.List;
import antlr.MismatchedTokenException;
import antlr.NoViableAltException;
import antlr.RecognitionException;
import antlr.collections.AST;
import antlr.collections.impl.BitSet;
/**
* Java 1.3 AST Recognizer.
*
* 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 JavaTreeParser extends antlr.TreeParser
implements
JavaTreeParserTokenTypes
{
private List variableRefs;
public void init()
{
this.variableRefs = new ArrayList();
}
public List getVariableReferences()
{
return this.variableRefs;
}
public JavaTreeParser()
{
tokenNames = _tokenNames;
}
public final void compilationUnit(AST _t) throws RecognitionException
{
AST compilationUnit_AST_in = (AST) _t;
try
{ // for error handling
{
if ( _t == null ) _t = ASTNULL;
switch ( _t.getType() )
{
case PACKAGE_DEF :
{
packageDefinition( _t );
_t = _retTree;
break;
}
case 3 :
case CLASS_DEF :
case INTERFACE_DEF :
case IMPORT :
{
break;
}
default :
{
throw new NoViableAltException( _t );
}
}
}
{
_loop325 : do
{
if ( _t == null ) _t = ASTNULL;
if ( (_t.getType() == IMPORT) )
{
importDefinition( _t );
_t = _retTree;
}
else
{
break _loop325;
}
}
while ( true );
}
{
_loop327 : do
{
if ( _t == null ) _t = ASTNULL;
if ( (_t.getType() == CLASS_DEF || _t.getType() == INTERFACE_DEF) )
{
typeDefinition( _t );
_t = _retTree;
}
else
{
break _loop327;
}
}
while ( true );
}
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void packageDefinition(AST _t) throws RecognitionException
{
AST packageDefinition_AST_in = (AST) _t;
try
{ // for error handling
AST __t347 = _t;
AST tmp1_AST_in = (AST) _t;
match( _t,
PACKAGE_DEF );
_t = _t.getFirstChild();
identifier( _t );
_t = _retTree;
_t = __t347;
_t = _t.getNextSibling();
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void importDefinition(AST _t) throws RecognitionException
{
AST importDefinition_AST_in = (AST) _t;
try
{ // for error handling
AST __t349 = _t;
AST tmp2_AST_in = (AST) _t;
match( _t,
IMPORT );
_t = _t.getFirstChild();
identifierStar( _t );
_t = _retTree;
_t = __t349;
_t = _t.getNextSibling();
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void typeDefinition(AST _t) throws RecognitionException
{
AST typeDefinition_AST_in = (AST) _t;
try
{ // for error handling
if ( _t == null ) _t = ASTNULL;
switch ( _t.getType() )
{
case CLASS_DEF :
{
AST __t351 = _t;
AST tmp3_AST_in = (AST) _t;
match( _t,
CLASS_DEF );
_t = _t.getFirstChild();
modifiers( _t );
_t = _retTree;
AST tmp4_AST_in = (AST) _t;
match( _t,
IDENT );
_t = _t.getNextSibling();
extendsClause( _t );
_t = _retTree;
implementsClause( _t );
_t = _retTree;
objBlock( _t );
_t = _retTree;
_t = __t351;
_t = _t.getNextSibling();
break;
}
case INTERFACE_DEF :
{
AST __t352 = _t;
AST tmp5_AST_in = (AST) _t;
match( _t,
INTERFACE_DEF );
_t = _t.getFirstChild();
modifiers( _t );
_t = _retTree;
AST tmp6_AST_in = (AST) _t;
match( _t,
IDENT );
_t = _t.getNextSibling();
extendsClause( _t );
_t = _retTree;
interfaceBlock( _t );
_t = _retTree;
_t = __t352;
_t = _t.getNextSibling();
break;
}
default :
{
throw new NoViableAltException( _t );
}
}
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void ruleFile(AST _t) throws RecognitionException
{
AST ruleFile_AST_in = (AST) _t;
try
{ // for error handling
{
_loop330 : do
{
if ( _t == null ) _t = ASTNULL;
if ( (_t.getType() == IMPORT) )
{
importDefinition( _t );
_t = _retTree;
}
else
{
break _loop330;
}
}
while ( true );
}
ruleSet( _t );
_t = _retTree;
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void ruleSet(AST _t) throws RecognitionException
{
AST ruleSet_AST_in = (AST) _t;
try
{ // for error handling
AST __t332 = _t;
AST tmp7_AST_in = (AST) _t;
match( _t,
RULE_SET );
_t = _t.getFirstChild();
AST tmp8_AST_in = (AST) _t;
match( _t,
IDENT );
_t = _t.getNextSibling();
{
int _cnt334 = 0;
_loop334 : do
{
if ( _t == null ) _t = ASTNULL;
if ( (_t.getType() == RULE) )
{
rule( _t );
_t = _retTree;
}
else
{
if ( _cnt334 >= 1 )
{
break _loop334;
}
else
{
throw new NoViableAltException( _t );
}
}
_cnt334++;
}
while ( true );
}
_t = __t332;
_t = _t.getNextSibling();
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void rule(AST _t) throws RecognitionException
{
AST rule_AST_in = (AST) _t;
try
{ // for error handling
AST __t336 = _t;
AST tmp9_AST_in = (AST) _t;
match( _t,
RULE );
_t = _t.getFirstChild();
AST tmp10_AST_in = (AST) _t;
match( _t,
IDENT );
_t = _t.getNextSibling();
AST __t337 = _t;
AST tmp11_AST_in = (AST) _t;
match( _t,
PARAMETERS );
_t = _t.getFirstChild();
{
int _cnt340 = 0;
_loop340 : do
{
if ( _t == null ) _t = ASTNULL;
if ( (_t.getType() == PARAMETER_DEF) )
{
AST __t339 = _t;
AST tmp12_AST_in = (AST) _t;
match( _t,
PARAMETER_DEF );
_t = _t.getFirstChild();
typeSpec( _t );
_t = _retTree;
AST tmp13_AST_in = (AST) _t;
match( _t,
IDENT );
_t = _t.getNextSibling();
_t = __t339;
_t = _t.getNextSibling();
}
else
{
if ( _cnt340 >= 1 )
{
break _loop340;
}
else
{
throw new NoViableAltException( _t );
}
}
_cnt340++;
}
while ( true );
}
_t = __t337;
_t = _t.getNextSibling();
whenBlock( _t );
_t = _retTree;
thenBlock( _t );
_t = _retTree;
_t = __t336;
_t = _t.getNextSibling();
}
catch ( RecognitionException ex )
{
reportError( ex );
if ( _t != null )
{
_t = _t.getNextSibling();
}
}
_retTree = _t;
}
public final void typeSpec(AST _t) throws RecognitionException
{
AST typeSpec_AST_in = (AST) _t;
try
{ // for error handling
AST __t354 = _t;
AST tmp14_AST_in = (AST) _t;
match( _t,
TYPE );
_t = _t.getFirstChild();
typeSpecArray( _t );
_t = _retTree;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -