本文整理汇总了C#中Parse.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Parse.GetType方法的具体用法?C# Parse.GetType怎么用?C# Parse.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse
的用法示例。
在下文中一共展示了Parse.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileElement
/// <summary>
/// Create the appropriate element and the appropriate quantifier
/// </summary>
/// <param name="Item">The elemen to compile</param>
/// <param name="Parent">The parent parsed block</param>
/// <param name="Compiled">The parent compiled block</param>
private void CompileElement(Parse.Element Item, Parse.Block Parent, Block Compiled)
{
//Just create a NOP for a null item
if (Item == null)
{
Compiled.AddItem(new NOP());
return;
}
//Anotate Item's commands
if (Output != null)
Item.Annotation.CompiledPosition.Begin = Output.Length;
_OutIdent++;
OutComment(Item.GetType().Name + Item.Quantifier);
//Check for quantifier
QuantifierBefore qb = null;
if (!Item.Quantifier.IsDefault())
{
if (Item.Quantifier.IsIfAny())
{
//Nothing, just add NOP after
}
else if (Item.Quantifier.IsAsMany() && !Item.Quantifier.Additive)
{
//Nothing, just add a ConditionalJump after
}
else if (Item.Quantifier.IsNever())
{
//Nothing, add a Fail and a NOP after
}
else
{
qb = new QuantifierBefore(Item.Quantifier);
Compiled.AddItem(qb);
}
}
int first_runnable_execution_index = Compiled.Count;
//Find item's type
if (Item is Parse.Block)
{
Parse.Block pabl = (Parse.Block)Item;
Block bl;
//New block if it is unnamed, or get the stub
if (pabl.Name == null)
bl = new Block(this);
else
bl = _BlocksByName[pabl.Name];
//Compile it
CompileBlock(pabl, bl);
//Create a call to the block
Compiled.AddItem(new CallBlock(bl.ExecuteBlock));
//Update it's index
bl.ExecuteIndex = Compiled.Items[first_runnable_execution_index];
}
else if (Item is Parse.TextSearch)
CETextSearch((Parse.TextSearch) Item, Parent, Compiled);
else if (Item is Parse.Literal)
CELiterall((Parse.Literal) Item, Compiled);
else if (Item is Parse.Variable)
CEVariable((Parse.Variable) Item, Parent, Compiled);
else if (Item is Parse.ControlFlow)
CEControlFlow((Parse.ControlFlow) Item, Parent, Compiled);
else if (Item is Parse.FunctionCall)
CEFunctionCall((Parse.FunctionCall) Item, Parent, Compiled);
else if (Item is Parse.BinaryOperator)
CEBinaryOperator((Parse.BinaryOperator) Item, Parent, Compiled);
else
{
Compiled.AddItem(new NOP());
ThrowParseError("Unkown type " + Item.GetType().Name, Item.Annotation.SourcePosition);
}
int last_runnable_execute_index = Compiled.Count - 1;
//Check for quantifier
if (!Item.Quantifier.IsDefault())
{
if (Item.Quantifier.IsIfAny())
{
//On failure jump here
var nop = new NOP();
Compiled.AddItem(nop);
//Update Runnables
CESetOnJumpFailTo(Compiled, first_runnable_execution_index, last_runnable_execute_index, nop);
//.........这里部分代码省略.........