📄 csharpparser.cs
字号:
match(REAL_LITERAL);
if (0==inputState.guessing)
{
literal_AST = (AST)currentAST.root;
literal_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.RealLiteral) astFactory.create(RealLiteral,literal_AST.getText())));
currentAST.root = literal_AST;
if ( (null != literal_AST) && (null != literal_AST.getFirstChild()) )
currentAST.child = literal_AST.getFirstChild();
else
currentAST.child = literal_AST;
currentAST.advanceChildToEnd();
}
literal_AST = currentAST.root;
break;
}
case CHARACTER_LITERAL:
{
AST tmp4_AST = null;
tmp4_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp4_AST);
match(CHARACTER_LITERAL);
if (0==inputState.guessing)
{
literal_AST = (AST)currentAST.root;
literal_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.CharLiteral) astFactory.create(CharLiteral,literal_AST.getText())));
currentAST.root = literal_AST;
if ( (null != literal_AST) && (null != literal_AST.getFirstChild()) )
currentAST.child = literal_AST.getFirstChild();
else
currentAST.child = literal_AST;
currentAST.advanceChildToEnd();
}
literal_AST = currentAST.root;
break;
}
case STRING_LITERAL:
{
AST tmp5_AST = null;
tmp5_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp5_AST);
match(STRING_LITERAL);
if (0==inputState.guessing)
{
literal_AST = (AST)currentAST.root;
literal_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.StringLiteral) astFactory.create(StringLiteral,literal_AST.getText())));
currentAST.root = literal_AST;
if ( (null != literal_AST) && (null != literal_AST.getFirstChild()) )
currentAST.child = literal_AST.getFirstChild();
else
currentAST.child = literal_AST;
currentAST.advanceChildToEnd();
}
literal_AST = currentAST.root;
break;
}
case NULL:
{
null_literal();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
if (0==inputState.guessing)
{
literal_AST = (AST)currentAST.root;
literal_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.NullLiteral) astFactory.create(NullLiteral,"null")));
currentAST.root = literal_AST;
if ( (null != literal_AST) && (null != literal_AST.getFirstChild()) )
currentAST.child = literal_AST.getFirstChild();
else
currentAST.child = literal_AST;
currentAST.advanceChildToEnd();
}
literal_AST = currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = literal_AST;
}
public void boolean_literal() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST boolean_literal_AST = null;
try { // for error handling
switch ( LA(1) )
{
case TRUE:
{
AST tmp6_AST = null;
tmp6_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp6_AST);
match(TRUE);
boolean_literal_AST = currentAST.root;
break;
}
case FALSE:
{
AST tmp7_AST = null;
tmp7_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp7_AST);
match(FALSE);
boolean_literal_AST = currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = boolean_literal_AST;
}
public void null_literal() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST null_literal_AST = null;
try { // for error handling
AST tmp8_AST = null;
tmp8_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp8_AST);
match(NULL);
null_literal_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_2_);
}
else
{
throw;
}
}
returnAST = null_literal_AST;
}
public void namespace_name() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST namespace_name_AST = null;
try { // for error handling
namespace_or_type_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
namespace_name_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_3_);
}
else
{
throw;
}
}
returnAST = namespace_name_AST;
}
public void namespace_or_type_name() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST namespace_or_type_name_AST = null;
try { // for error handling
simple_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
{ // ( ... )*
for (;;)
{
if ((LA(1)==DOT))
{
match(DOT);
simple_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
}
else
{
goto _loop10_breakloop;
}
}
_loop10_breakloop: ;
} // ( ... )*
namespace_or_type_name_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_4_);
}
else
{
throw;
}
}
returnAST = namespace_or_type_name_AST;
}
public void type_name() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST type_name_AST = null;
try { // for error handling
namespace_or_type_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
type_name_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_4_);
}
else
{
throw;
}
}
returnAST = type_name_AST;
}
public void simple_name() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST simple_name_AST = null;
try { // for error handling
identifier();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
simple_name_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_5_);
}
else
{
throw;
}
}
returnAST = simple_name_AST;
}
public void type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST type_AST = null;
Token obj = null;
AST obj_AST = null;
Token str = null;
AST str_AST = null;
try { // for error handling
if (((LA(1) >= BOOL && LA(1) <= DOUBLE)) && (tokenSet_6_.member(LA(2))))
{
value_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
type_AST = currentAST.root;
}
else {
bool synPredMatched13 = false;
if (((tokenSet_7_.member(LA(1))) && (LA(2)==DOT||LA(2)==LBRACK)))
{
int _m13 = mark();
synPredMatched13 = true;
inputState.guessing++;
try {
{
array_type();
}
}
catch (RecognitionException)
{
synPredMatched13 = false;
}
rewind(_m13);
inputState.guessing--;
}
if ( synPredMatched13 )
{
array_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
type_AST = currentAST.root;
}
else if ((LA(1)==IDENTIFIER) && (tokenSet_8_.member(LA(2)))) {
type_name();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
type_AST = currentAST.root;
}
else if ((LA(1)==OBJECT) && (tokenSet_6_.member(LA(2)))) {
obj = LT(1);
obj_AST = astFactory.create(obj);
match(OBJECT);
if (0==inputState.guessing)
{
type_AST = (AST)currentAST.root;
type_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.BuiltInType) astFactory.create(BuiltInType,obj_AST.getText())));
currentAST.root = type_AST;
if ( (null != type_AST) && (null != type_AST.getFirstChild()) )
currentAST.child = type_AST.getFirstChild();
else
currentAST.child = type_AST;
currentAST.advanceChildToEnd();
}
}
else if ((LA(1)==STRING) && (tokenSet_6_.member(LA(2)))) {
str = LT(1);
str_AST = astFactory.create(str);
match(STRING);
if (0==inputState.guessing)
{
type_AST = (AST)currentAST.root;
type_AST = (AST)astFactory.make( (new ASTArray(1)).add((DDW.CSharp.Parse.BuiltInType) astFactory.create(BuiltInType,str_AST.getText())));
currentAST.root = type_AST;
if ( (null != type_AST) && (null != type_AST.getFirstChild()) )
currentAST.child = type_AST.getFirstChild();
else
currentAST.child = type_AST;
currentAST.advanceChildToEnd();
}
}
else
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_6_);
}
else
{
throw;
}
}
returnAST = type_AST;
}
public void value_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST value_type_AST = null;
AST st_AST = null;
try { // for error handling
struct_type();
if (0 == inputState.guessing)
{
st_AST = (AST)returnAST;
}
if (0==inputState.guessing)
{
value_type_AST = (AST)currentAST.root;
value_type_AST =
(AST)astFactory.make( (new ASTArray(2)).add(value_type_AST).add((DDW.CSharp.Parse.BuiltInType) astFactory.create(BuiltInType,st_AST.getText())));
currentAST.root = value_type_AST;
if ( (null != value_type_AST) && (null != value_type_AST.getFirstChild()) )
currentAST.child = value_type_AST.getFirstChild();
else
currentAST.child = value_type_AST;
currentAST.advanceChildToEnd();
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_9_);
}
else
{
throw;
}
}
returnAST = value_type_AST;
}
public void array_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
AST array_type_AST = null;
try { // for error handling
non_array_type();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
rank_specifiers();
if (0 == inputState.guessing)
{
astFactory.addASTChild(currentAST, returnAST);
}
array_type_AST = currentAST.root;
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex);
consume();
consumeUntil(tokenSet_10_);
}
else
{
throw;
}
}
returnAST = array_type_AST;
}
public void struct_type() //throws RecognitionException, TokenStreamException
{
returnAST = null;
ASTPair currentAST = new ASTPair();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -