gnucparser.java
来自「plugin for eclipse」· Java 代码 · 共 2,584 行 · 第 1/5 页
JAVA
2,584 行
}
TNode tmp33_AST = null;
tmp33_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp33_AST);
match(RCURLY);
if ( inputState.guessing==0 ) {
lcurlyInitializer_AST = (TNode)currentAST.root;
lcurlyInitializer_AST.setType( NLcurlyInitializer );
}
lcurlyInitializer_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_28);
} else {
throw ex;
}
}
returnAST = lcurlyInitializer_AST;
}
public final void constExpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode constExpr_AST = null;
try { // for error handling
conditionalExpr();
astFactory.addASTChild(currentAST, returnAST);
constExpr_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_29);
} else {
throw ex;
}
}
returnAST = constExpr_AST;
}
public final void rangeExpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode rangeExpr_AST = null;
try { // for error handling
constExpr();
astFactory.addASTChild(currentAST, returnAST);
TNode tmp34_AST = null;
tmp34_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp34_AST);
match(VARARGS);
constExpr();
astFactory.addASTChild(currentAST, returnAST);
if ( inputState.guessing==0 ) {
rangeExpr_AST = (TNode)currentAST.root;
rangeExpr_AST = (TNode)astFactory.make( (new ASTArray(2)).add((TNode)astFactory.create(NRangeExpr)).add(rangeExpr_AST));
currentAST.root = rangeExpr_AST;
currentAST.child = rangeExpr_AST!=null &&rangeExpr_AST.getFirstChild()!=null ?
rangeExpr_AST.getFirstChild() : rangeExpr_AST;
currentAST.advanceChildToEnd();
}
rangeExpr_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_30);
} else {
throw ex;
}
}
returnAST = rangeExpr_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);
{
_loop2101:
do {
if ((LA(1)==COMMA) && (_tokenSet_18.member(LA(2)))) {
match(COMMA);
initializer();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop2101;
}
} while (true);
}
initializerList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_31);
} else {
throw ex;
}
}
returnAST = initializerList_AST;
}
public final void pointerGroup() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode pointerGroup_AST = null;
try { // for error handling
{
int _cnt2290=0;
_loop2290:
do {
if ((LA(1)==STAR)) {
TNode tmp36_AST = null;
tmp36_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp36_AST);
match(STAR);
{
_loop2289:
do {
if ((LA(1)==LITERAL_volatile||LA(1)==LITERAL_const)) {
typeQualifier();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop2289;
}
} while (true);
}
}
else {
if ( _cnt2290>=1 ) { break _loop2290; } else {throw new NoViableAltException(LT(1), getFilename());}
}
_cnt2290++;
} 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 declaratorParamaterList(
boolean isFunctionDefinition, String declName
) throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode declaratorParamaterList_AST = null;
try { // for error handling
TNode tmp37_AST = null;
tmp37_AST = (TNode)astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp37_AST);
match(LPAREN);
if ( inputState.guessing==0 ) {
if (isFunctionDefinition) {
pushScope(declName);
}
else {
pushScope("!"+declName);
}
}
{
boolean synPredMatched2111 = false;
if (((_tokenSet_6.member(LA(1))) && (_tokenSet_33.member(LA(2))))) {
int _m2111 = mark();
synPredMatched2111 = true;
inputState.guessing++;
try {
{
declSpecifiers();
}
}
catch (RecognitionException pe) {
synPredMatched2111 = false;
}
rewind(_m2111);
inputState.guessing--;
}
if ( synPredMatched2111 ) {
parameterTypeList();
astFactory.addASTChild(currentAST, returnAST);
}
else if ((_tokenSet_34.member(LA(1))) && (_tokenSet_35.member(LA(2)))) {
{
switch ( LA(1)) {
case ID:
{
idList();
astFactory.addASTChild(currentAST, returnAST);
break;
}
case COMMA:
case RPAREN:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
if ( inputState.guessing==0 ) {
popScope();
}
{
switch ( LA(1)) {
case COMMA:
{
match(COMMA);
break;
}
case RPAREN:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
TNode tmp39_AST = null;
tmp39_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp39_AST);
match(RPAREN);
if ( inputState.guessing==0 ) {
declaratorParamaterList_AST = (TNode)currentAST.root;
declaratorParamaterList_AST.setType(NParameterTypeList);
}
declaratorParamaterList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_35);
} else {
throw ex;
}
}
returnAST = declaratorParamaterList_AST;
}
public final void declSpecifiers() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
TNode declSpecifiers_AST = null;
TNode s_AST = null;
int specCount=0;
try { // for error handling
{
int _cnt2271=0;
_loop2271:
do {
switch ( LA(1)) {
case LITERAL_typedef:
case LITERAL_auto:
case LITERAL_register:
case LITERAL_extern:
case LITERAL_static:
case LITERAL_inline:
{
storageClassSpecifier();
s_AST = (TNode)returnAST;
astFactory.addASTChild(currentAST, returnAST);
break;
}
case LITERAL_volatile:
case LITERAL_const:
{
typeQualifier();
astFactory.addASTChild(currentAST, returnAST);
break;
}
default:
boolean synPredMatched2270 = false;
if (((_tokenSet_15.member(LA(1))) && (_tokenSet_33.member(LA(2))))) {
int _m2270 = mark();
synPredMatched2270 = true;
inputState.guessing++;
try {
{
if ((LA(1)==LITERAL_struct) && (true)) {
match(LITERAL_struct);
}
else if ((LA(1)==LITERAL_union) && (true)) {
match(LITERAL_union);
}
else if ((LA(1)==LITERAL_enum) && (true)) {
match(LITERAL_enum);
}
else if ((_tokenSet_15.member(LA(1))) && (true)) {
typeSpecifier(specCount);
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException pe) {
synPredMatched2270 = false;
}
rewind(_m2270);
inputState.guessing--;
}
if ( synPredMatched2270 ) {
specCount=typeSpecifier(specCount);
astFactory.addASTChild(currentAST, returnAST);
}
else {
if ( _cnt2271>=1 ) { break _loop2271; } else {throw new NoViableAltException(LT(1), getFilename());}
}
}
_cnt2271++;
} while (true);
}
declSpecifiers_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_36);
} else {
throw ex;
}
}
returnAST = declSpecifiers_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);
{
_loop2117:
do {
if ((LA(1)==SEMI||LA(1)==COMMA) && (_tokenSet_6.member(LA(2)))) {
{
switch ( LA(1)) {
case COMMA:
{
TNode tmp40_AST = null;
tmp40_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp40_AST);
match(COMMA);
break;
}
case SEMI:
{
TNode tmp41_AST = null;
tmp41_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp41_AST);
match(SEMI);
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
parameterDeclaration();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop2117;
}
} while (true);
}
{
if ((LA(1)==SEMI||LA(1)==COMMA) && (LA(2)==VARARGS)) {
{
switch ( LA(1)) {
case COMMA:
{
TNode tmp42_AST = null;
tmp42_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp42_AST);
match(COMMA);
break;
}
case SEMI:
{
TNode tmp43_AST = null;
tmp43_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp43_AST);
match(SEMI);
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
TNode tmp44_AST = null;
tmp44_AST = (TNode)astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp44_AST);
match(VARARGS);
}
else if ((LA(1)==COMMA||LA(1)==RPAREN) && (_tokenSet_35.member(LA(2)))) {
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
parameterTypeList_AST = (TNode)currentAST.root;
}
catch (RecognitionException ex) {
if (inputState.guessing==0) {
reportError(ex);
recover(ex,_tokenSet_5);
} 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 synPredMatched2294 = false;
if (((_tokenSet_10.member(LA(1))) && (_tokenSet_37.member(LA(2))))) {
int _m2294 = mark();
synPredMatched2294 = true;
inputState.guessing++;
try {
{
declarator(false);
}
}
catch (RecognitionException pe) {
synPredMatched2294 = false;
}
rewind(_m2294);
inputState.guessing--;
}
if ( synPredMatched2294 ) {
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_38.member(LA(1))) && (_tokenSet_39.member(LA(2)))) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?