本文整理汇总了C#中Scope.Parent方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.Parent方法的具体用法?C# Scope.Parent怎么用?C# Scope.Parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.Parent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: forLoop
//.........这里部分代码省略.........
state.followingStackPointer--;
forNode.SetInit(dec);
}
break;
}
Match(input, Token.UP, null);
}
Match(input,FORCOND,FOLLOW_FORCOND_in_forLoop425);
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null);
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:186:82: (cond= expression )?
int alt4 = 2;
int LA4_0 = input.LA(1);
if ( (LA4_0 == NEGATE || LA4_0 == STRING || (LA4_0 >= STRINGNOQUOTES && LA4_0 <= VARDEC) || LA4_0 == METH_CALL || LA4_0 == Identifier || (LA4_0 >= IntegerAtom && LA4_0 <= Animation) || LA4_0 == 67 || (LA4_0 >= 69 && LA4_0 <= 81)) )
{
alt4 = 1;
}
switch (alt4)
{
case 1 :
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:186:83: cond= expression
{
PushFollow(FOLLOW_expression_in_forLoop430);
cond = expression();
state.followingStackPointer--;
forNode.SetCondition(cond);
}
break;
}
Match(input, Token.UP, null);
}
Match(input,FORITER,FOLLOW_FORITER_in_forLoop438);
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null);
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:186:150: (iter= statement )?
int alt5 = 2;
int LA5_0 = input.LA(1);
if ( ((LA5_0 >= AT && LA5_0 <= IF) || (LA5_0 >= VARDEF && LA5_0 <= ASSIGN) || LA5_0 == OBJMETHOD || (LA5_0 >= VARINC && LA5_0 <= BREAK) || (LA5_0 >= METH_CALL && LA5_0 <= RETURN) || (LA5_0 >= 60 && LA5_0 <= 61)) )
{
alt5 = 1;
}
switch (alt5)
{
case 1 :
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:186:151: iter= statement
{
PushFollow(FOLLOW_statement_in_forLoop443);
iter = statement();
state.followingStackPointer--;
forNode.SetIteration(iter);
}
break;
}
Match(input, Token.UP, null);
}
PushFollow(FOLLOW_block_in_forLoop450);
block24 = block();
state.followingStackPointer--;
Match(input, Token.UP, null);
forNode.SetBlock(block24);
}
currentScope = currentScope.Parent();
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return node;
}
示例2: block
// $ANTLR end "compilationUnit"
// $ANTLR start "block"
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:112:1: block returns [SGLNode node] : ^( BLOCK ^( STATEMENTS ( statement )* ) ) ;
public SGLNode block() // throws RecognitionException [1]
{
SGLNode node = default(SGLNode);
SGLNode statement2 = default(SGLNode);
Scope scope = new Scope(currentScope);
currentScope = scope;
BlockNode bn = new BlockNode(spriteObjects, currentScope);
node = bn;
try
{
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:122:2: ( ^( BLOCK ^( STATEMENTS ( statement )* ) ) )
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:122:4: ^( BLOCK ^( STATEMENTS ( statement )* ) )
{
Match(input,BLOCK,FOLLOW_BLOCK_in_block95);
Match(input, Token.DOWN, null);
Match(input,STATEMENTS,FOLLOW_STATEMENTS_in_block111);
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null);
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:123:24: ( statement )*
do
{
int alt1 = 2;
int LA1_0 = input.LA(1);
if ( ((LA1_0 >= AT && LA1_0 <= IF) || (LA1_0 >= VARDEF && LA1_0 <= ASSIGN) || LA1_0 == OBJMETHOD || (LA1_0 >= VARINC && LA1_0 <= BREAK) || (LA1_0 >= METH_CALL && LA1_0 <= RETURN) || (LA1_0 >= 60 && LA1_0 <= 61)) )
{
alt1 = 1;
}
switch (alt1)
{
case 1 :
// C:\\Users\\Dominik Halfkann\\Documents\\Visual Studio 2010\\Projects\\SGLParserTester\\SGL\\AntlrParser\\SGLTreeWalker.g:123:25: statement
{
PushFollow(FOLLOW_statement_in_block114);
statement2 = statement();
state.followingStackPointer--;
bn.AddStatement(statement2);
}
break;
default:
goto loop1;
}
} while (true);
loop1:
; // Stops C# compiler whining that label 'loop1' has no statements
Match(input, Token.UP, null);
}
Match(input, Token.UP, null);
}
currentScope = currentScope.Parent();
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return node;
}
示例3: block
// $ANTLR end "main"
// $ANTLR start "block"
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:137:1: block returns [SGLNode node] : ^( BLOCK ( statement )* ) ;
public SGLNode block() // throws RecognitionException [1]
{
SGLNode node = default(SGLNode);
SGLNode statement2 = default(SGLNode);
Scope scope = new Scope(currentScope);
currentScope = scope;
BlockNode bn = new BlockNode(spriteObjects, currentScope);
node = bn;
try
{
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:147:2: ( ^( BLOCK ( statement )* ) )
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:147:4: ^( BLOCK ( statement )* )
{
Match(input,BLOCK,FOLLOW_BLOCK_in_block104);
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null);
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:148:10: ( statement )*
do
{
int alt1 = 2;
int LA1_0 = input.LA(1);
if ( (LA1_0 == ASSIGN || (LA1_0 >= VARINC && LA1_0 <= VARDEC) || (LA1_0 >= METH_CALL && LA1_0 <= IF) || LA1_0 == GLOBAL_ASSIGN || (LA1_0 >= 85 && LA1_0 <= 86)) )
{
alt1 = 1;
}
switch (alt1)
{
case 1 :
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:148:11: statement
{
PushFollow(FOLLOW_statement_in_block119);
statement2 = statement();
state.followingStackPointer--;
bn.AddStatement(statement2);
}
break;
default:
goto loop1;
}
} while (true);
loop1:
; // Stops C# compiler whining that label 'loop1' has no statements
Match(input, Token.UP, null);
}
}
currentScope = currentScope.Parent();
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return node;
}
示例4: SGLTreeWalker
public SGLTreeWalker(CommonTreeNodeStream nodes, Scope sc, Dictionary<String, Method> mths) : this(nodes) {
currentScope = sc;
globalScope = sc.Parent();
methods = mths;
}
示例5: forLoop
//.........这里部分代码省略.........
state.followingStackPointer--;
forNode.SetInit(dec);
}
break;
}
Match(input, Token.UP, null);
}
Match(input,FORCOND,FOLLOW_FORCOND_in_forLoop527);
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null);
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:223:82: (cond= expression )?
int alt10 = 2;
int LA10_0 = input.LA(1);
if ( ((LA10_0 >= STRING && LA10_0 <= VARDEC) || LA10_0 == LOOKUP || (LA10_0 >= IntAtom && LA10_0 <= LoopTypeAtom) || (LA10_0 >= Null && LA10_0 <= List) || LA10_0 == 63 || (LA10_0 >= 65 && LA10_0 <= 78)) )
{
alt10 = 1;
}
switch (alt10)
{
case 1 :
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:223:83: cond= expression
{
PushFollow(FOLLOW_expression_in_forLoop532);
cond = expression();
state.followingStackPointer--;
forNode.SetCondition(cond);
}
break;
}
Match(input, Token.UP, null);
}
Match(input,FORITER,FOLLOW_FORITER_in_forLoop540);
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null);
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:223:150: (iter= statement )?
int alt11 = 2;
int LA11_0 = input.LA(1);
if ( (LA11_0 == ASSIGN || (LA11_0 >= VARINC && LA11_0 <= VARDEC) || (LA11_0 >= METH_CALL && LA11_0 <= IF) || LA11_0 == GLOBAL_ASSIGN || (LA11_0 >= 85 && LA11_0 <= 86)) )
{
alt11 = 1;
}
switch (alt11)
{
case 1 :
// D:\\sgl4c#\\NewSGLGramma\\SGLTreeWalker.g:223:151: iter= statement
{
PushFollow(FOLLOW_statement_in_forLoop545);
iter = statement();
state.followingStackPointer--;
forNode.SetIteration(iter);
}
break;
}
Match(input, Token.UP, null);
}
PushFollow(FOLLOW_block_in_forLoop552);
block25 = block();
state.followingStackPointer--;
Match(input, Token.UP, null);
forNode.SetBlock(block25);
}
currentScope = currentScope.Parent();
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return node;
}