Esempio n. 1
0
 public Expr OnParseBreak()
 {
     var tokenIt = this._parser.TokenIt;
     var initiatorToken = tokenIt.NextToken;
     var expr = new BreakExpr();
     // <codeBreak>
     tokenIt.Advance();
     // </codeBreak>
     this._parser.SetupContext(expr, initiatorToken);
     return expr;
 }
Esempio n. 2
0
        /// <summary>
        /// Execute the break.
        /// </summary>
        public object VisitBreak(BreakExpr expr)
        {
            var loop = expr.FindParent<ILoop>();
            if (loop == null)
                throw new LangException("syntax error", "unable to break, loop not found", string.Empty, 0);

            loop.DoBreakLoop = true;
            return LObjects.Null;
        }