本文整理汇总了C#中LNode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LNode.ToString方法的具体用法?C# LNode.ToString怎么用?C# LNode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LNode
的用法示例。
在下文中一共展示了LNode.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeToTerminalPred
public override Pred CodeToTerminalPred(LNode expr, ref string errorMsg)
{
bool isInt = false;
PGIntSet set;
if (expr.IsIdNamed(_underscore)) {
set = PGIntSet.AllExceptEOF;
} else if (expr.IsIdNamed(_EOF)) {
set = PGIntSet.EOF;
} else if (expr.Calls(S.DotDot, 2)) {
int? from = ConstValue(expr.Args[0], ref isInt);
int? to = ConstValue(expr.Args[1], ref isInt);
if (from == null || to == null) {
errorMsg = "Expected int32 or character literal on each side of «..»";
return null;
}
set = PGIntSet.WithRanges(from.Value, to.Value);
} else if (expr.Value is string) {
return Pred.Seq((string)expr.Value);
} else {
int? num = ConstValue(expr, ref isInt);
if (num == null) {
errorMsg = "Unrecognized expression. Expected int32 or character literal instead of: " + expr.ToString(); // warning
return null;
}
set = PGIntSet.With(num.Value);
}
set.IsCharSet = !isInt;
return new TerminalPred(expr, set, true);
}
示例2: CheckIsComplexIdentifier
void CheckIsComplexIdentifier(bool? result, LNode expr)
{
var np = new EcsNodePrinter(expr, null);
_testNum++;
var isCI = EcsValidators.IsComplexIdentifier(expr);
if (result == null && !isCI)
return;
else if (result == isCI)
return;
Assert.Fail(string.Format(
"IsComplexIdentifier: fail on test #{0} '{1}'. Expected {2}, got {3}",
_testNum, expr.ToString(), result, isCI));
}
示例3: WhereClausesOpt
void WhereClausesOpt(ref LNode name)
{
TokenType la0;
#line 1163 "EcsParserGrammar.les"
var list = new BMultiMap<Symbol,LNode>();
#line default
// Line 1164: (WhereClause)*
for (;;) {
la0 = LA0;
if (la0 == TT.ContextualKeyword)
list.Add(WhereClause());
else
break;
}
#line 1165 "EcsParserGrammar.les"
if ((list.Count != 0)) {
if ((!name.CallsMin(S.Of, 2))) {
Error("'{0}' is not generic and cannot use 'where' clauses.", name.ToString());
} else {
var tparams = name.Args.ToRWList();
for (int i = 1; i < tparams.Count; i++) {
var wheres = list[TParamSymbol(tparams[i])];
tparams[i] = tparams[i].PlusAttrs(wheres);
wheres.Clear();
}
name = name.WithArgs(tparams.ToRVList());
if ((list.Count > 0)) {
Error(list[0].Value, "There is no type parameter named '{0}'", list[0].Key);
}
}
}
#line default
}
示例4: CheckIsComplexIdentifier
void CheckIsComplexIdentifier(bool? result, LNode expr)
{
var np = new EcsNodePrinter(expr, null);
_testNum++;
var is1 = np.IsComplexIdentifier(expr);
var is2 = np.IsComplexIdentifierOrNull(expr.Target);
if (result == null && !is1 && is2)
return;
else if (result == is1 && result == is2)
return;
Assert.Fail(string.Format(
"IsComplexIdentifier: fail on test #{0} '{1}'. Expected {2}, got {3}/{4}",
_testNum, expr.ToString(), result, is1, is2));
}
示例5: CheckIsComplexIdentifier
void CheckIsComplexIdentifier(bool? result, LNode expr)
{
_testNum++;
var isCI = EcsValidators.IsComplexIdentifier(expr, ICI.Default, EcsValidators.Pedantics.Strict);
if (result == null && !isCI)
return;
else if (result == isCI)
return;
Assert.Fail(string.Format(
"IsComplexIdentifier: fail on test #{0} '{1}'. Expected {2}, got {3}",
_testNum, expr.ToString(), result, isCI));
}