stdcparser.java
来自「plugin for eclipse」· Java 代码 · 共 2,566 行 · 第 1/5 页
JAVA
2,566 行
throw ex;
}
}
returnAST = initializer_AST;
}
public final void pointerGroup() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode pointerGroup_AST = null;
try { // for error handling
{
int _cnt1458=0;
_loop1458:
do {
if ((LA(1)==STAR)) {
TNode tmp54_AST = null;
tmp54_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp54_AST);
match(STAR);
{
_loop1457:
do {
if ((LA(1)==LITERAL_volatile||LA(1)==LITERAL_const)) {
typeQualifier();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop1457;
}
} while (true);
}
}
else {
if ( _cnt1458>=1 ) { break _loop1458; } else {throw new NoViableAltException(LT(1), getFilename());}
}
_cnt1458++;
} while (true);
}
if ( inputState.guessing==0 ) {
pointerGroup_AST = (TNode)currentAST.root;
pointerGroup_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NPointerGroup)).add(pointerGroup_AST));
currentAST.root = pointerGroup_AST;
currentAST.child = pointerGroup_AST!=null &&pointerGroup_AST.getFirstChild()!=null ?
pointerGroup_AST.getFirstChild() : pointerGroup_AST;
currentAST.advanceChildToEnd();
}
pointerGroup_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_32);
} else {
throw ex;
}
}
returnAST = pointerGroup_AST;
}
public final void idList() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode idList_AST = null;
try { // for error handling
TNode tmp55_AST = null;
tmp55_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp55_AST);
match(ID);
{
_loop1461:
do {
if ((LA(1)==COMMA)) {
match(COMMA);
TNode tmp57_AST = null;
tmp57_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp57_AST);
match(ID);
}
else {
break _loop1461;
}
} while (true);
}
idList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_33);
} else {
throw ex;
}
}
returnAST = idList_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_12);
} else {
throw ex;
}
}
returnAST = assignExpr_AST;
}
public final void initializerList() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode initializerList_AST = null;
try { // for error handling
initializer();
astFactory.addASTChild(currentAST, returnAST);
{
_loop1467:
do {
if ((LA(1)==COMMA) && (_tokenSet_34.member(LA(2)))) {
match(COMMA);
initializer();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop1467;
}
} while (true);
}
initializerList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_30);
} else {
throw ex;
}
}
returnAST = initializerList_AST;
}
public final void parameterTypeList() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode parameterTypeList_AST = null;
try { // for error handling
parameterDeclaration();
astFactory.addASTChild(currentAST, returnAST);
{
_loop1480:
do {
if ((LA(1)==COMMA) && (_tokenSet_2.member(LA(2)))) {
match(COMMA);
parameterDeclaration();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop1480;
}
} while (true);
}
{
switch ( LA(1)) {
case COMMA:
{
match(COMMA);
TNode tmp61_AST = null;
tmp61_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp61_AST);
match(VARARGS);
break;
}
case RPAREN:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
parameterTypeList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_33);
} else {
throw ex;
}
}
returnAST = parameterTypeList_AST;
}
public final void parameterDeclaration() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode parameterDeclaration_AST = null;
TNode ds_AST = null;
TNode d_AST = null;
String declName;
try { // for error handling
declSpecifiers();
ds_AST = (TNode)returnAST;
astFactory.addASTChild(currentAST, returnAST);
{
boolean synPredMatched1485 = false;
if (((_tokenSet_10.member(LA(1))) && (_tokenSet_35.member(LA(2))))) {
int _m1485 = mark();
synPredMatched1485 = true;
inputState.guessing++;
try {
{
declarator(false);
}
}
catch (RecognitionException pe) {
synPredMatched1485 = false;
}
rewind(_m1485);
inputState.guessing--;
}
if ( synPredMatched1485 ) {
declName=declarator(false);
d_AST = (TNode)returnAST;
astFactory.addASTChild(currentAST, returnAST);
if ( inputState.guessing==0 ) {
AST d2, ds2;
d2 = astFactory.dupList(d_AST);
ds2 = astFactory.dupList(ds_AST);
symbolTable.add(declName, (TNode)astFactory.make( (new ASTArray(3)).add(null).add(ds2).add(d2)));
}
}
else if ((_tokenSet_36.member(LA(1))) && (_tokenSet_37.member(LA(2)))) {
nonemptyAbstractDeclarator();
astFactory.addASTChild(currentAST, returnAST);
}
else if ((LA(1)==COMMA||LA(1)==RPAREN)) {
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
if ( inputState.guessing==0 ) {
parameterDeclaration_AST = (TNode)currentAST.root;
parameterDeclaration_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NParameterDeclaration)).add(parameterDeclaration_AST));
currentAST.root = parameterDeclaration_AST;
currentAST.child = parameterDeclaration_AST!=null &¶meterDeclaration_AST.getFirstChild()!=null ?
parameterDeclaration_AST.getFirstChild() : parameterDeclaration_AST;
currentAST.advanceChildToEnd();
}
parameterDeclaration_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_38);
} else {
throw ex;
}
}
returnAST = parameterDeclaration_AST;
}
public final void nonemptyAbstractDeclarator() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode nonemptyAbstractDeclarator_AST = null;
try { // for error handling
{
switch ( LA(1)) {
case STAR:
{
pointerGroup();
astFactory.addASTChild(currentAST, returnAST);
{
_loop1579:
do {
switch ( LA(1)) {
case LPAREN:
{
{
TNode tmp62_AST = null;
tmp62_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp62_AST);
match(LPAREN);
{
switch ( LA(1)) {
case STAR:
case LPAREN:
case LBRACKET:
{
nonemptyAbstractDeclarator();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case LITERAL_typedef:
case LITERAL_volatile:
case LITERAL_struct:
case LITERAL_union:
case LITERAL_enum:
case LITERAL_auto:
case LITERAL_register:
case LITERAL_extern:
case LITERAL_static:
case LITERAL_const:
case LITERAL_void:
case LITERAL_char:
case LITERAL_short:
case LITERAL_int:
case LITERAL_long:
case LITERAL_float:
case LITERAL_double:
case LITERAL_signed:
case LITERAL_unsigned:
case ID:
{
parameterTypeList();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case RPAREN:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
TNode tmp63_AST = null;
tmp63_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp63_AST);
match(RPAREN);
}
break;
}
case LBRACKET:
{
{
TNode tmp64_AST = null;
tmp64_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp64_AST);
match(LBRACKET);
{
switch ( LA(1)) {
case ID:
case STAR:
case LPAREN:
case BAND:
case PLUS:
case MINUS:
case INC:
case DEC:
case LITERAL_sizeof:
case BNOT:
case LNOT:
case CharLiteral:
case StringLiteral:
case IntOctalConst:
case LongOctalConst:
case UnsignedOctalConst:
case IntIntConst:
case LongIntConst:
case UnsignedIntConst:
case IntHexConst:
case LongHexConst:
case UnsignedHexConst:
case FloatDoubleConst:
case DoubleDoubleConst:
case LongDoubleConst:
{
expr();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case RBRACKET:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
TNode tmp65_AST = null;
tmp65_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp65_AST);
match(RBRACKET);
}
break;
}
default:
{
break _loop1579;
}
}
} while (true);
}
break;
}
case LPAREN:
case LBRACKET:
{
{
int _cnt1585=0;
_loop1585:
do {
switch ( LA(1)) {
case LPAREN:
{
{
TNode tmp66_AST = null;
tmp66_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp66_AST);
match(LPAREN);
{
switch ( LA(1)) {
case STAR:
case LPAREN:
case LBRACKET:
{
nonemptyAbstractDeclarator();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case LITERAL_typedef:
case LITERAL_volatile:
case LITERAL_struct:
case
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?