public override void Interpret(Context.Context context) { context.SkipToken("LOOP"); number = context.GetCurrentNumber(); context.NextToken(); // 循环语句中的表达式 commandNode = new ExpressionNode(); commandNode.Interpret(context); }
public override void Interpret(Context.Context context) { name = context.GetCurrentToken(); context.SkipToken(name); if (!name.Equals("PRINT", StringComparison.OrdinalIgnoreCase) && !name.Equals("BREAK", StringComparison.OrdinalIgnoreCase) && !name.Equals("SPACE", StringComparison.OrdinalIgnoreCase)) { Console.WriteLine("非法命令!"); } if (name.Equals("PRINT", StringComparison.OrdinalIgnoreCase)) { text = context.GetCurrentToken(); context.NextToken(); } }