本文整理汇总了C#中Irony.FindTokenAndGetText方法的典型用法代码示例。如果您正苦于以下问题:C# Irony.FindTokenAndGetText方法的具体用法?C# Irony.FindTokenAndGetText怎么用?C# Irony.FindTokenAndGetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Irony
的用法示例。
在下文中一共展示了Irony.FindTokenAndGetText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
{
base.Init(context, treeNode);
if (treeNode.ChildNodes[1].FirstChild.ChildNodes.Count > 0)
AddChild("value", treeNode.ChildNodes[1].FirstChild.FirstChild);
this.AsString = treeNode.FindTokenAndGetText();
}
示例2: Init
public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
{
base.Init(context, treeNode);
AsString = "";
value = treeNode.FindTokenAndGetText();
value = value.Substring(1, value.Length - 2);
value = UnescapeString(value);
}
示例3: Init
public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
{
base.Init(context, treeNode);
string weekday = treeNode.FindTokenAndGetText().ToLower();
switch (weekday)
{
case "monday": DayOfWeek = System.DayOfWeek.Monday; break;
case "tuesday": DayOfWeek = System.DayOfWeek.Tuesday; break;
case "wednesday": DayOfWeek = System.DayOfWeek.Wednesday; break;
case "thursday": DayOfWeek = System.DayOfWeek.Thursday; break;
case "friday": DayOfWeek = System.DayOfWeek.Friday; break;
case "saturaday":
case "sunday": throw new Exception("No operation can be performed on Saturaday or Sunday");
default:
throw new Exception("Unrecognized day:" + weekday);
}
}
示例4: Init
public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
{
base.Init(context, treeNode);
this.AsString = treeNode.FindTokenAndGetText();
}
示例5: ParseNumber
public static int ParseNumber(Irony.Parsing.ParseTreeNode node)
{
return int.Parse(node.FindTokenAndGetText());
}
示例6: Init
public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
{
base.Init(context, treeNode);
rawValue = treeNode.FindTokenAndGetText();
rawValue = rawValue.Substring(1, rawValue.Length - 2);
var opParse = Peepholes.operandParser.Parse(rawValue);
if (opParse.HasErrors()) parsedOperand = Operand.fromString(rawValue);
else
{
parsedOperand = Ast.Assembly.OperandAstNode.ParseOperand(opParse.Root.FirstChild);
}
}