📄 csharpparser.cs
字号:
break;
}
case OUT:
{
AST tmp28_AST = null;
tmp28_AST = astFactory.create(LT(1));
match(OUT);
if (0==inputState.guessing)
{
parameter_direction_AST = (AST)currentAST.root;
parameter_direction_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.ArgDirection) astFactory.create(ArgDirection,"out")));
currentAST.root = parameter_direction_AST;
if ( (null != parameter_direction_AST) && (null != parameter_direction_AST.getFirstChild()) )
currentAST.child = parameter_direction_AST.getFirstChild();
else
currentAST.child = parameter_direction_AST;
currentAST.advanceChildToEnd();
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_15_);
}
else
{
throw;
}
}
returnAST = parameter_direction_AST;
}
public void parenthesized_expression() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST parenthesized_expression_AST = null;
AST ex_AST = null;
try { // for error handling
AST tmp29_AST = null;
tmp29_AST = astFactory.create(LT(1));
match(LPAREN);
expression();
if (0 == inputState.guessing)
{
ex_AST = (AST)returnAST;
}
AST tmp30_AST = null;
tmp30_AST = astFactory.create(LT(1));
match(RPAREN);
if (0==inputState.guessing)
{
parenthesized_expression_AST = (AST)currentAST.root;
parenthesized_expression_AST =
(AST)astFactory.make( (new ASTArray(2)).add((AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.SubExpr) astFactory.create(SubExpr)))).add(ex_AST));
currentAST.root = parenthesized_expression_AST;
if ( (null != parenthesized_expression_AST) && (null != parenthesized_expression_AST.getFirstChild()) )
currentAST.child = parenthesized_expression_AST.getFirstChild();
else
currentAST.child = parenthesized_expression_AST;
currentAST.advanceChildToEnd();
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = parenthesized_expression_AST;
}
public void primary_start() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST primary_start_AST = null;
try { // for error handling
switch ( LA(1) )
{
case INTEGER_LITERAL:
case HEXADECIMAL_INTEGER_LITERAL:
case REAL_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
case TRUE:
case FALSE:
case NULL:
{
literal();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case IDENTIFIER:
{
simple_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case LPAREN:
{
parenthesized_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case THIS:
{
this_access();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case BASE:
{
base_access();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case TYPEOF:
{
typeof_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case SIZEOF:
{
sizeof_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case CHECKED:
{
checked_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case UNCHECKED:
{
unchecked_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
case OBJECT:
case STRING:
case BOOL:
case DECIMAL:
case SBYTE:
case BYTE:
case SHORT:
case USHORT:
case INT:
case UINT:
case LONG:
case ULONG:
case CHAR:
case FLOAT:
case DOUBLE:
{
predefined_type_access();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
break;
}
default:
bool synPredMatched45 = false;
if (((LA(1)==NEW) && (tokenSet_7_.member(LA(2)))))
{
int _m45 = mark();
synPredMatched45 = true;
inputState.guessing++;
try {
{
array_creation_expression();
}
}
catch (RecognitionException)
{
synPredMatched45 = false;
}
rewind(_m45);
inputState.guessing--;
}
if ( synPredMatched45 )
{
array_creation_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
}
else if ((LA(1)==NEW) && (tokenSet_7_.member(LA(2)))) {
object_creation_expression();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
primary_start_AST = currentAST.root;
}
else
{
throw new NoViableAltException(LT(1), getFilename());
}
break; }
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = primary_start_AST;
}
public void this_access() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST this_access_AST = null;
try { // for error handling
AST tmp31_AST = null;
tmp31_AST = astFactory.create(LT(1));
match(THIS);
if (0==inputState.guessing)
{
this_access_AST = (AST)currentAST.root;
this_access_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.ThisRefExpr) astFactory.create(ThisRefExpr)));
currentAST.root = this_access_AST;
if ( (null != this_access_AST) && (null != this_access_AST.getFirstChild()) )
currentAST.child = this_access_AST.getFirstChild();
else
currentAST.child = this_access_AST;
currentAST.advanceChildToEnd();
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = this_access_AST;
}
public void base_access() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST base_access_AST = null;
AST id_AST = null;
AST ea_AST = null;
try { // for error handling
if ((LA(1)==BASE) && (LA(2)==DOT))
{
AST tmp32_AST = null;
tmp32_AST = astFactory.create(LT(1));
match(BASE);
AST tmp33_AST = null;
tmp33_AST = astFactory.create(LT(1));
match(DOT);
identifier();
if (0 == inputState.guessing)
{
id_AST = (AST)returnAST;
}
if (0==inputState.guessing)
{
base_access_AST = (AST)currentAST.root;
base_access_AST = (AST)astFactory.make( (new ASTArray(2)).add((DDW.CSharp.Parse.BaseRefExpr) astFactory.create(BaseRefExpr)).add(id_AST));
currentAST.root = base_access_AST;
if ( (null != base_access_AST) && (null != base_access_AST.getFirstChild()) )
currentAST.child = base_access_AST.getFirstChild();
else
currentAST.child = base_access_AST;
currentAST.advanceChildToEnd();
}
}
else if ((LA(1)==BASE) && (LA(2)==LBRACK)) {
AST tmp34_AST = null;
tmp34_AST = astFactory.create(LT(1));
match(BASE);
element_access();
if (0 == inputState.guessing)
{
ea_AST = (AST)returnAST;
}
if (0==inputState.guessing)
{
base_access_AST = (AST)currentAST.root;
base_access_AST = (AST)astFactory.make( (new ASTArray(2)).add((DDW.CSharp.Parse.BaseRefExpr) astFactory.create(BaseRefExpr)).add(ea_AST));
currentAST.root = base_access_AST;
if ( (null != base_access_AST) && (null != base_access_AST.getFirstChild()) )
currentAST.child = base_access_AST.getFirstChild();
else
currentAST.child = base_access_AST;
currentAST.advanceChildToEnd();
}
}
else
{
throw new NoViableAltException(LT(1), getFilename());
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = base_access_AST;
}
public void array_creation_expression() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST array_creation_expression_AST = null;
AST tp_AST = null;
AST ini_AST = null;
AST tp2_AST = null;
AST el2_AST = null;
AST rnk2_AST = null;
AST ini2_AST = null;
try { // for error handling
bool synPredMatched74 = false;
if (((LA(1)==NEW) && (tokenSet_7_.member(LA(2)))))
{
int _m74 = mark();
synPredMatched74 = true;
inputState.guessing++;
try {
{
match(NEW);
array_type();
array_initializer();
}
}
catch (RecognitionException)
{
synPredMatched74 = false;
}
rewind(_m74);
inputState.guessing--;
}
if ( synPredMatched74 )
{
AST tmp35_AST = null;
tmp35_AST = astFactory.create(LT(1));
match(NEW);
array_type();
if (0 == inputState.guessing)
{
tp_AST = (AST)returnAST;
}
array_initializer();
if (0 == inputState.guessing)
{
ini_AST = (AST)returnAST;
}
if (0==inputState.guessing)
{
array_creation_expression_AST = (AST)currentAST.root;
array_creation_expression_AST =
(AST)astFactory.make( (new ASTArray(3)).add((DDW.CSharp.Parse.ArrayCreateExpr) astFactory.create(ArrayCreateExpr)).add((AST)astFactory.make( (new ASTArray(2)).add((DDW.CSharp.Parse.TypeRef) astFactory.create(TypeRef)).add(tp_AST))).add(ini_AST));
currentAST.root = array_creation_expression_AST;
if ( (null != array_creation_expression_AST) && (null != array_creation_expression_AST.getFirstChild()) )
currentAST.child = array_creation_expression_AST.getFirstChild();
else
currentAST.child = array_creation_expression_AST;
currentAST.advanceChildToEnd();
}
}
else if ((LA(1)==NEW) && (tokenSet_7_.member(LA(2)))) {
AST tmp36_AST = null;
tmp36_AST = astFactory.create(LT(1));
match(NEW);
non_array_type();
if (0 == inputState.guessing)
{
tp2_AST = (AST)returnAST;
}
match(LBRACK);
expression_list();
if (0 == inputState.guessing)
{
el2_AST = (AST)returnAST;
}
match(RBRACK);
{
if ((LA(1)==LBRACK) && (LA(2)==COMMA||LA(2)==RBRACK))
{
rank_specifiers();
if (0 == inputState.guessing)
{
rnk2_AST = (AST)returnAST;
}
}
else if ((tokenSet_20_.member(LA(1))) && (tokenSet_21_.member(LA(2)))) {
}
else
{
throw new NoViableAltException(LT(1), getFilename());
}
}
{
switch ( LA(1) )
{
case LBRACE:
{
array_initializer();
if (0 == inputState.guessing)
{
ini2_AST = (AST)returnAST;
}
break;
}
case IDENTIFIER:
case DOT:
case LBRACK:
case COMMA:
case RBRACK:
case LPAREN:
case RPAREN:
case INC:
case DEC:
case PLUS:
case MIN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -