gnucparser.java
来自「plugin for eclipse」· Java 代码 · 共 2,584 行 · 第 1/5 页
JAVA
2,584 行
tmp19_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp19_AST);
match(LBRACKET);
{
switch ( LA(1)) {
case LITERAL_asm:
case ID:
case STAR:
case LPAREN:
case LAND:
case BAND:
case PLUS:
case MINUS:
case INC:
case DEC:
case LITERAL_sizeof:
case BNOT:
case LNOT:
case CharLiteral:
case StringLiteral:
case Number:
case LITERAL___alignof:
case LITERAL___real:
case LITERAL___imag:
{
expr();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case RBRACKET:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
TNode tmp20_AST = null;
tmp20_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp20_AST);
match(RBRACKET);
break;
}
default:
{
break _loop2107;
}
}
} while (true);
}
if ( inputState.guessing==0 ) {
declarator_AST = (TNode)currentAST.root;
declarator_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NDeclarator)).add(declarator_AST));
currentAST.root = declarator_AST;
currentAST.child = declarator_AST!=null &&declarator_AST.getFirstChild()!=null ?
declarator_AST.getFirstChild() : declarator_AST;
currentAST.advanceChildToEnd();
}
declarator_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_16);
} else {
throw ex;
}
}
returnAST = declarator_AST;
return declName;
}
public final void initDeclList(
AST declarationSpecifiers
) throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode initDeclList_AST = null;
try { // for error handling
initDecl(declarationSpecifiers);
astFactory.addASTChild(currentAST, returnAST);
{
_loop2172:
do {
if ((LA(1)==COMMA) && (_tokenSet_10.member(LA(2)))) {
match(COMMA);
initDecl(declarationSpecifiers);
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop2172;
}
} while (true);
}
{
switch ( LA(1)) {
case COMMA:
{
match(COMMA);
break;
}
case SEMI:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
initDeclList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_17);
} else {
throw ex;
}
}
returnAST = initDeclList_AST;
}
public final void initializer() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode initializer_AST = null;
try { // for error handling
{
if ((_tokenSet_18.member(LA(1))) && (_tokenSet_19.member(LA(2)))) {
{
{
boolean synPredMatched2087 = false;
if (((_tokenSet_20.member(LA(1))) && (_tokenSet_21.member(LA(2))))) {
int _m2087 = mark();
synPredMatched2087 = true;
inputState.guessing++;
try {
{
initializerElementLabel();
}
}
catch (RecognitionException pe) {
synPredMatched2087 = false;
}
rewind(_m2087);
inputState.guessing--;
}
if ( synPredMatched2087 ) {
initializerElementLabel();
astFactory.addASTChild(currentAST, returnAST);
}
else if ((_tokenSet_22.member(LA(1))) && (_tokenSet_23.member(LA(2)))) {
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
{
switch ( LA(1)) {
case LITERAL_asm:
case ID:
case STAR:
case LPAREN:
case LAND:
case BAND:
case PLUS:
case MINUS:
case INC:
case DEC:
case LITERAL_sizeof:
case BNOT:
case LNOT:
case CharLiteral:
case StringLiteral:
case Number:
case LITERAL___alignof:
case LITERAL___real:
case LITERAL___imag:
{
assignExpr();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case LCURLY:
{
lcurlyInitializer();
astFactory.addASTChild(currentAST, returnAST);
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
initializer_AST = (TNode)currentAST.root;
initializer_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitializer)).add(initializer_AST));
currentAST.root = initializer_AST;
currentAST.child = initializer_AST!=null &&initializer_AST.getFirstChild()!=null ?
initializer_AST.getFirstChild() : initializer_AST;
currentAST.advanceChildToEnd();
}
}
}
else if ((LA(1)==LCURLY) && (_tokenSet_24.member(LA(2)))) {
lcurlyInitializer();
astFactory.addASTChild(currentAST, returnAST);
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
initializer_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_25);
} else {
throw ex;
}
}
returnAST = initializer_AST;
}
public final void initializerElementLabel() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode initializerElementLabel_AST = null;
try { // for error handling
{
switch ( LA(1)) {
case LBRACKET:
{
{
TNode tmp23_AST = null;
tmp23_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp23_AST);
match(LBRACKET);
{
boolean synPredMatched2094 = false;
if (((_tokenSet_3.member(LA(1))) && (_tokenSet_26.member(LA(2))))) {
int _m2094 = mark();
synPredMatched2094 = true;
inputState.guessing++;
try {
{
constExpr();
match(VARARGS);
}
}
catch (RecognitionException pe) {
synPredMatched2094 = false;
}
rewind(_m2094);
inputState.guessing--;
}
if ( synPredMatched2094 ) {
rangeExpr();
astFactory.addASTChild(currentAST, returnAST);
}
else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_27.member(LA(2)))) {
constExpr();
astFactory.addASTChild(currentAST, returnAST);
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
TNode tmp24_AST = null;
tmp24_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp24_AST);
match(RBRACKET);
{
switch ( LA(1)) {
case ASSIGN:
{
TNode tmp25_AST = null;
tmp25_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp25_AST);
match(ASSIGN);
break;
}
case LITERAL_asm:
case LCURLY:
case ID:
case STAR:
case LPAREN:
case LAND:
case BAND:
case PLUS:
case MINUS:
case INC:
case DEC:
case LITERAL_sizeof:
case BNOT:
case LNOT:
case CharLiteral:
case StringLiteral:
case Number:
case LITERAL___alignof:
case LITERAL___real:
case LITERAL___imag:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
break;
}
case ID:
{
TNode tmp26_AST = null;
tmp26_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp26_AST);
match(ID);
TNode tmp27_AST = null;
tmp27_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp27_AST);
match(COLON);
break;
}
case DOT:
{
TNode tmp28_AST = null;
tmp28_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp28_AST);
match(DOT);
TNode tmp29_AST = null;
tmp29_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp29_AST);
match(ID);
TNode tmp30_AST = null;
tmp30_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp30_AST);
match(ASSIGN);
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
initializerElementLabel_AST = (TNode)currentAST.root;
initializerElementLabel_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NInitializerElementLabel)).add(initializerElementLabel_AST)) ;
currentAST.root = initializerElementLabel_AST;
currentAST.child = initializerElementLabel_AST!=null &&initializerElementLabel_AST.getFirstChild()!=null ?
initializerElementLabel_AST.getFirstChild() : initializerElementLabel_AST;
currentAST.advanceChildToEnd();
}
initializerElementLabel_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_22);
} else {
throw ex;
}
}
returnAST = initializerElementLabel_AST;
}
public final void assignExpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode assignExpr_AST = null;
TNode a_AST = null;
try { // for error handling
conditionalExpr();
astFactory.addASTChild(currentAST, returnAST);
{
switch ( LA(1)) {
case ASSIGN:
case DIV_ASSIGN:
case PLUS_ASSIGN:
case MINUS_ASSIGN:
case STAR_ASSIGN:
case MOD_ASSIGN:
case RSHIFT_ASSIGN:
case LSHIFT_ASSIGN:
case BAND_ASSIGN:
case BOR_ASSIGN:
case BXOR_ASSIGN:
{
assignOperator();
a_AST = (TNode)returnAST;
assignExpr();
astFactory.addASTChild(currentAST, returnAST);
if ( inputState.guessing==0 ) {
assignExpr_AST = (TNode)currentAST.root;
assignExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add(a_AST).add(assignExpr_AST));
currentAST.root = assignExpr_AST;
currentAST.child = assignExpr_AST!=null &&assignExpr_AST.getFirstChild()!=null ?
assignExpr_AST.getFirstChild() : assignExpr_AST;
currentAST.advanceChildToEnd();
}
break;
}
case RCURLY:
case SEMI:
case COMMA:
case COLON:
case RPAREN:
case RBRACKET:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
assignExpr_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_4);
} else {
throw ex;
}
}
returnAST = assignExpr_AST;
}
public final void lcurlyInitializer() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode lcurlyInitializer_AST = null;
try { // for error handling
TNode tmp31_AST = null;
tmp31_AST = (TNode)astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp31_AST);
match(LCURLY);
{
switch ( LA(1)) {
case LITERAL_asm:
case LCURLY:
case ID:
case STAR:
case LPAREN:
case LBRACKET:
case LAND:
case BAND:
case PLUS:
case MINUS:
case INC:
case DEC:
case LITERAL_sizeof:
case BNOT:
case LNOT:
case DOT:
case CharLiteral:
case StringLiteral:
case Number:
case LITERAL___alignof:
case LITERAL___real:
case LITERAL___imag:
{
initializerList();
astFactory.addASTChild(currentAST, returnAST);
{
switch ( LA(1)) {
case COMMA:
{
match(COMMA);
break;
}
case RCURLY:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
break;
}
case RCURLY:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?