public override int VisitFor([NotNull] TemplateParser.ForContext context) { MakeClassificationSpan(context.keyword, classificater.ClassificationKeyword); MakeBracePair(context.PARENTHESES_L(), context.PARENTHESES_R()); MakeBracePair(context.BRACE_L(), context.BRACE_R()); return(base.VisitFor(context)); }
public override int VisitFor([NotNull] TemplateParser.ForContext context) { PushStack(); try { var codes = context.code(); if (context.expr0 != null) { VisitVar(context.expr0); } else if (context.expr1 != null) { ExecExpr(context.expr1); } while (true) { for (int i = 0; i < codes.Length; i++) { codes[i].Accept(this); } if (context.expr3 != null) { ExecExpr(context.expr3); } if (context.expr2 != null) { var v = ExecExpr(context.expr2); if (v.type == AtomType.BOOL && (bool)v.value == false) { break; } } } } finally { PopStack(); } return(0); }
/// <summary> /// Visit a parse tree produced by <see cref="TemplateParser.for"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitFor([NotNull] TemplateParser.ForContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="TemplateParser.for"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitFor([NotNull] TemplateParser.ForContext context) { }