本文整理汇总了C#中Expression.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Add方法的具体用法?C# Expression.Add怎么用?C# Expression.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadExpression
private Expression ReadExpression(ScriptReader source, bool readTerminatingSymbolFromStream, params PredefinedSymbol[] endsWithSymbols)
{
Expression expression = new Expression();
int bracketLevel = 0;
while (bracketLevel >= 0)
{
foreach (PredefinedSymbol terminatingSymbol in endsWithSymbols)
{
if ((bracketLevel == 0) && (source.NextIsKeyword(terminatingSymbol, !readTerminatingSymbolFromStream)))
{
return expression;
}
}
Token thisToken = source.PeekNextToken();
if (thisToken is EndOfStreamToken)
{
throw new CompilerMessage(ErrorCode.EndOfInputReached, "End of script reached in the middle of an expression");
}
CompilerUtils.AdjustBracketLevelIfTokenIsBracket(thisToken, ref bracketLevel);
if (bracketLevel >= 0)
{
expression.Add(source.ReadNextToken());
}
}
throw new CompilerMessage(ErrorCode.UnexpectedToken, "Unexpected '" + source.ReadNextToken() + "'");
}
示例2: Expression
public IExpression Expression(IBlockNode Scope = null)
{
// AssignExpression
var ass = AssignExpression(Scope);
if (laKind != (Comma))
return ass;
/*
* The following is a leftover of C syntax and proably cause some errors when parsing arguments etc.
*/
// AssignExpression , Expression
var ae = new Expression();
ae.Add(ass);
while (laKind == (Comma))
{
Step();
ae.Add(AssignExpression(Scope));
}
return ae;
}