本文整理汇总了C#中Crayon.ParseTree.Expression类的典型用法代码示例。如果您正苦于以下问题:C# Expression类的具体用法?C# Expression怎么用?C# Expression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Expression类属于Crayon.ParseTree命名空间,在下文中一共展示了Expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FunctionCall
public FunctionCall(Expression root, Token parenToken, IList<Expression> args, Executable owner)
: base(root.FirstToken, owner)
{
this.Root = root;
this.ParenToken = parenToken;
this.Args = args.ToArray();
}
示例2: TranslateGlDrawArrays
public override void TranslateGlDrawArrays(List<string> output, Expression gl, Expression vertexCount)
{
this.Translator.TranslateExpression(output, gl);
output.Add(".glDrawArrays(javax.microedition.khronos.opengles.GL10.GL_TRIANGLE_STRIP, 0, ");
this.Translator.TranslateExpression(output, vertexCount);
output.Add(")");
}
示例3: GetLiteralId
public int GetLiteralId(Expression value)
{
if (value is NullConstant)
{
return GetNullConstant();
}
if (value is IntegerConstant)
{
return this.GetIntConstant(((IntegerConstant)value).Value);
}
if (value is FloatConstant)
{
return this.GetFloatConstant(((FloatConstant)value).Value);
}
if (value is BooleanConstant)
{
return this.GetBoolConstant(((BooleanConstant)value).Value);
}
if (value is StringConstant)
{
return this.GetStringConstant(((StringConstant)value).Value);
}
return -1;
}
示例4: IfStatement
public IfStatement(Token ifToken, Expression condition, IList<Executable> trueCode, IList<Executable> falseCode, Executable owner)
: base(ifToken, owner)
{
this.Condition = condition;
this.TrueCode = trueCode.ToArray();
this.FalseCode = falseCode.ToArray();
}
示例5: DotStep
public DotStep(Expression root, Token dotToken, Token stepToken, Executable owner)
: base(root.FirstToken, owner)
{
this.Root = root;
this.DotToken = dotToken;
this.StepToken = stepToken;
}
示例6: TranslateGlBindTexture
public override void TranslateGlBindTexture(List<string> output, Expression gl, Expression textureId)
{
this.Translator.TranslateExpression(output, gl);
output.Add(".glBindTexture(javax.microedition.khronos.opengles.GL10.GL_TEXTURE_2D, ");
this.Translator.TranslateExpression(output, textureId);
output.Add(")");
}
示例7: TranslateGet2dDigitalAxisValue
public override void TranslateGet2dDigitalAxisValue(List<string> output, Expression device, Expression digitalAxisIndex)
{
this.Translator.TranslateExpression(output, device);
output.Add(".get_hat(");
this.Translator.TranslateExpression(output, digitalAxisIndex);
output.Add(")");
}
示例8: TranslateGetButtonValue
public override void TranslateGetButtonValue(List<string> output, Expression device, Expression buttonIndex)
{
this.Translator.TranslateExpression(output, device);
output.Add(".get_button(");
this.Translator.TranslateExpression(output, buttonIndex);
output.Add(")");
}
示例9: SwitchStatement
public SwitchStatement(Token switchToken, Expression condition, List<Token> firstTokens, List<List<Expression>> cases, List<List<Executable>> code, Expression explicitMax, Token explicitMaxToken, Executable owner)
: base(switchToken, owner)
{
if (cases.Count == 0) throw new ParserException(switchToken, "Switch statement needs cases.");
if (code.Count == 0) throw new ParserException(switchToken, "Switch statement needs code.");
if (cases[0] == null) throw new ParserException(switchToken, "Switch statement must start with a case.");
if (cases[cases.Count - 1] != null) throw new ParserException(switchToken, "Last case in switch statement is empty.");
this.Condition = condition;
this.explicitMax = explicitMax;
this.explicitMaxToken = explicitMaxToken;
List<Chunk> chunks = new List<Chunk>();
int counter = 0;
for (int i = 0; i < cases.Count; i += 2)
{
if (cases[i] == null) throw new Exception("This should not happen.");
if (code[i + 1] == null) throw new Exception("This should not happen.");
Chunk chunk = new Chunk(counter++, firstTokens[i], cases[i], code[i + 1]);
if (chunk.Code.Length > 0 && chunk.ContainsFallthrough)
{
throw new ParserException(firstTokens[i], "This switch statement case contains code, but falls through to the next case. Cases that contain code must end with a return or break statement.");
}
chunks.Add(chunk);
}
this.chunks = chunks.ToArray();
if (this.chunks.Length == 1 && this.chunks[0].Cases.Length == 1 && this.chunks[0].Cases[0] == null)
{
throw new ParserException(switchToken, "Switches need at least 1 case to indicate type.");
}
}
示例10: TranslateGetAnalogAxisValue
public override void TranslateGetAnalogAxisValue(List<string> output, Expression device, Expression analogAxisIndex)
{
this.Translator.TranslateExpression(output, device);
output.Add(".get_axis(");
this.Translator.TranslateExpression(output, analogAxisIndex);
output.Add(")");
}
示例11: TranslateArrayGet
protected override void TranslateArrayGet(List<string> output, Expression list, Expression index)
{
this.Translator.TranslateExpression(output, list);
output.Add("[");
this.Translator.TranslateExpression(output, index);
output.Add("]");
}
示例12: BinaryOpChain
public BinaryOpChain(Expression left, Token op, Expression right, Executable owner)
: base(left.FirstToken, owner)
{
this.Left = left;
this.Right = right;
this.Op = op;
}
示例13: ForEachLoop
public ForEachLoop(Token forToken, Token iterationVariable, Expression iterationExpression, IList<Executable> code, Executable owner)
: base(forToken, owner)
{
this.IterationVariable = iterationVariable;
this.IterationExpression = iterationExpression;
this.Code = code.ToArray();
}
示例14: ForLoop
public ForLoop(Token forToken, IList<Executable> init, Expression condition, IList<Executable> step, IList<Executable> code, Executable owner)
: base(forToken, owner)
{
this.Init = init.ToArray();
this.Condition = condition ?? new BooleanConstant(forToken, true, owner);
this.Step = step.ToArray();
this.Code = code.ToArray();
}
示例15: Assignment
public Assignment(Expression target, Token assignmentOpToken, string assignmentOp, Expression assignedValue, Executable owner)
: base(target.FirstToken, owner)
{
this.Target = target;
this.AssignmentOpToken = assignmentOpToken;
this.AssignmentOp = assignmentOp;
this.Value = assignedValue;
}