本文整理汇总了C#中Program.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Program.AddChild方法的具体用法?C# Program.AddChild怎么用?C# Program.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program.AddChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Prog
private Program Prog()
{
if ((Token.Types)currentToken.Type == Token.Types.Var ||
(Token.Types)currentToken.Type == Token.Types.Identifier ||
(Token.Types)currentToken.Type == Token.Types.For ||
(Token.Types)currentToken.Type == Token.Types.Read ||
(Token.Types)currentToken.Type == Token.Types.Print ||
(Token.Types)currentToken.Type == Token.Types.Assert) {
Program program = new Program ("program", currentToken.Row, currentToken.Column);
program.AddChild (Stmts ());
return program;
}
throw new SyntaxError ("invalid start symbol of a program " + currentToken.Type,
currentToken.Row, currentToken.Column);
}
示例2: program
public Program program()
{
EnterRule_program();
EnterRule("program", 1);
TraceIn("program", 1);
Program prg = default(Program);
IToken programHead1 = default(IToken);
List<Node> block2 = default(List<Node>);
prg = new Program();
try { DebugEnterRule(GrammarFileName, "program");
DebugLocation(27, 5);
try
{
// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:32:2: ( programHead block programTail )
DebugEnterAlt(1);
// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:32:4: programHead block programTail
{
DebugLocation(32, 4);
PushFollow(Follow._programHead_in_program51);
programHead1=programHead();
PopFollow();
DebugLocation(33, 3);
prg.SetName(programHead1);
DebugLocation(36, 3);
PushFollow(Follow._block_in_program59);
block2=block();
PopFollow();
DebugLocation(37, 3);
foreach(var child in block2)
{
prg.AddChild(child);
}
DebugLocation(43, 3);
PushFollow(Follow._programTail_in_program68);
programTail();
PopFollow();
}
}
catch (RecognitionException e)
{
throw e;
}
finally
{
TraceOut("program", 1);
LeaveRule("program", 1);
LeaveRule_program();
}
DebugLocation(44, 5);
} finally { DebugExitRule(GrammarFileName, "program"); }
return prg;
}