📄 csharpparser.cs
字号:
AST struct_type_AST = null;
try { // for error handling
simple_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
struct_type_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_9_);
}
else
{
throw;
}
}
returnAST = struct_type_AST;
}
public void simple_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST simple_type_AST = null;
try { // for error handling
switch ( LA(1) )
{
case DECIMAL:
case SBYTE:
case BYTE:
case SHORT:
case USHORT:
case INT:
case UINT:
case LONG:
case ULONG:
case CHAR:
case FLOAT:
case DOUBLE:
{
numeric_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
simple_type_AST = currentAST.root;
break;
}
case BOOL:
{
AST tmp10_AST = null;
tmp10_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp10_AST);
match(BOOL);
simple_type_AST = currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_9_);
}
else
{
throw;
}
}
returnAST = simple_type_AST;
}
public void numeric_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST numeric_type_AST = null;
try { // for error handling
switch ( LA(1) )
{
case SBYTE:
case BYTE:
case SHORT:
case USHORT:
case INT:
case UINT:
case LONG:
case ULONG:
case CHAR:
{
integral_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
numeric_type_AST = currentAST.root;
break;
}
case FLOAT:
case DOUBLE:
{
floating_point_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
numeric_type_AST = currentAST.root;
break;
}
case DECIMAL:
{
AST tmp11_AST = null;
tmp11_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp11_AST);
match(DECIMAL);
numeric_type_AST = currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_9_);
}
else
{
throw;
}
}
returnAST = numeric_type_AST;
}
public void integral_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST integral_type_AST = null;
try { // for error handling
switch ( LA(1) )
{
case SBYTE:
{
AST tmp12_AST = null;
tmp12_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp12_AST);
match(SBYTE);
integral_type_AST = currentAST.root;
break;
}
case BYTE:
{
AST tmp13_AST = null;
tmp13_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp13_AST);
match(BYTE);
integral_type_AST = currentAST.root;
break;
}
case SHORT:
{
AST tmp14_AST = null;
tmp14_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp14_AST);
match(SHORT);
integral_type_AST = currentAST.root;
break;
}
case USHORT:
{
AST tmp15_AST = null;
tmp15_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp15_AST);
match(USHORT);
integral_type_AST = currentAST.root;
break;
}
case INT:
{
AST tmp16_AST = null;
tmp16_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp16_AST);
match(INT);
integral_type_AST = currentAST.root;
break;
}
case UINT:
{
AST tmp17_AST = null;
tmp17_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp17_AST);
match(UINT);
integral_type_AST = currentAST.root;
break;
}
case LONG:
{
AST tmp18_AST = null;
tmp18_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp18_AST);
match(LONG);
integral_type_AST = currentAST.root;
break;
}
case ULONG:
{
AST tmp19_AST = null;
tmp19_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp19_AST);
match(ULONG);
integral_type_AST = currentAST.root;
break;
}
case CHAR:
{
AST tmp20_AST = null;
tmp20_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp20_AST);
match(CHAR);
integral_type_AST = currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_11_);
}
else
{
throw;
}
}
returnAST = integral_type_AST;
}
public void floating_point_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST floating_point_type_AST = null;
try { // for error handling
switch ( LA(1) )
{
case FLOAT:
{
AST tmp21_AST = null;
tmp21_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp21_AST);
match(FLOAT);
floating_point_type_AST = currentAST.root;
break;
}
case DOUBLE:
{
AST tmp22_AST = null;
tmp22_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp22_AST);
match(DOUBLE);
floating_point_type_AST = currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_9_);
}
else
{
throw;
}
}
returnAST = floating_point_type_AST;
}
public void reference_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST reference_type_AST = null;
try { // for error handling
bool synPredMatched22 = false;
if (((LA(1)==IDENTIFIER||LA(1)==OBJECT||LA(1)==STRING) && (LA(2)==EOF||LA(2)==DOT)))
{
int _m22 = mark();
synPredMatched22 = true;
inputState.guessing++;
try {
{
class_type();
}
}
catch (RecognitionException)
{
synPredMatched22 = false;
}
rewind(_m22);
inputState.guessing--;
}
if ( synPredMatched22 )
{
class_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
reference_type_AST = currentAST.root;
}
else {
bool synPredMatched24 = false;
if (((tokenSet_7_.member(LA(1))) && (LA(2)==DOT||LA(2)==LBRACK)))
{
int _m24 = mark();
synPredMatched24 = true;
inputState.guessing++;
try {
{
array_type();
}
}
catch (RecognitionException)
{
synPredMatched24 = false;
}
rewind(_m24);
inputState.guessing--;
}
if ( synPredMatched24 )
{
array_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
reference_type_AST = currentAST.root;
}
else
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_1_);
}
else
{
throw;
}
}
returnAST = reference_type_AST;
}
public void class_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST class_type_AST = null;
Token obj = null;
AST obj_AST = null;
Token str = null;
AST str_AST = null;
try { // for error handling
switch ( LA(1) )
{
case IDENTIFIER:
{
type_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
class_type_AST = currentAST.root;
break;
}
case OBJECT:
{
obj = LT(1);
obj_AST = astFactory.create(obj);
match(OBJECT);
if (0==inputState.guessing)
{
class_type_AST = (AST)currentAST.root;
class_type_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.BuiltInType) astFactory.create(BuiltInType,obj_AST.getText())));
currentAST.root = class_type_AST;
if ( (null != class_type_AST) && (null != class_type_AST.getFirstChild()) )
currentAST.child = class_type_AST.getFirstChild();
else
currentAST.child = class_type_AST;
currentAST.advanceChildToEnd();
}
break;
}
case STRING:
{
str = LT(1);
str_AST = astFactory.create(str);
match(STRING);
if (0==inputState.guessing)
{
class_type_AST = (AST)currentAST.root;
class_type_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.BuiltInType) astFactory.create(BuiltInType,str_AST.getText())));
currentAST.root = class_type_AST;
if ( (null != class_type_AST) && (null != class_type_AST.getFirstChild()) )
currentAST.child = class_type_AST.getFirstChild();
else
currentAST.child = class_type_AST;
currentAST.advanceChildToEnd();
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_12_);
}
else
{
throw;
}
}
returnAST = class_type_AST;
}
public void non_array_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST non_array_type_AST = null;
try { // for error handling
switch ( LA(1) )
{
case IDENTIFIER:
case OBJECT:
case STRING:
{
class_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
non_array_type_AST = currentAST.root;
break;
}
case BOOL:
case DECIMAL:
case SBYTE:
case BYTE:
case SHORT:
case USHORT:
case INT:
case UINT:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -