Exemplo n.º 1
0
 private static AstNode ParseFor(TokenStream stream)
 {
     ForStatement ret = new ForStatement (stream.Location);
     stream.Expect (TokenClass.Keyword, "for");
     stream.Expect (TokenClass.OpenParan);
     ret.Add (new Expression (stream.Location, ParseExpression (stream)));
     stream.Expect (TokenClass.SemiColon);
     ret.Add (ParseExpression (stream));
     stream.Expect (TokenClass.SemiColon);
     ret.Add (new Expression (stream.Location, ParseExpression (stream)));
     stream.Expect (TokenClass.CloseParan);
     ret.Add (ParseStatement (stream));
     return ret;
 }
Exemplo n.º 2
0
 public void Accept(ForStatement forStmt)
 {
     forStmt.Visit (functionCompiler);
 }
Exemplo n.º 3
0
		public override void Accept (ForStatement forStmt)
		{
			IodineLabel forLabel = methodBuilder.CreateLabel ();
			IodineLabel breakLabel = methodBuilder.CreateLabel ();
			IodineLabel skipAfterThought = methodBuilder.CreateLabel ();
			breakLabels.Push (breakLabel);
			continueLabels.Push (forLabel);
			forStmt.Initializer.Visit (this);
			methodBuilder.EmitInstruction (forStmt.Location, Opcode.Jump, skipAfterThought);
			methodBuilder.MarkLabelPosition (forLabel);
			forStmt.AfterThought.Visit (this);
			methodBuilder.MarkLabelPosition (skipAfterThought);
			forStmt.Condition.Visit (this);
			methodBuilder.EmitInstruction (forStmt.Condition.Location, Opcode.JumpIfFalse, breakLabel);
			forStmt.Body.Visit (this);
			forStmt.AfterThought.Visit (this);
			methodBuilder.EmitInstruction (forStmt.AfterThought.Location, Opcode.Jump, skipAfterThought);
			methodBuilder.MarkLabelPosition (breakLabel);
			breakLabels.Pop ();
			continueLabels.Pop ();
		}
Exemplo n.º 4
0
		public override void Accept (ForStatement forStmt)
		{
			errorLog.AddError (ErrorType.ParserError, forStmt.Location,
				"statement can not exist inside pattern!");
		}
Exemplo n.º 5
0
 public virtual void Accept(ForStatement forStmt)
 {
 }
Exemplo n.º 6
0
 public void Accept(ForStatement forStmt)
 {
     forStmt.VisitChildren (this);
 }
Exemplo n.º 7
0
 public void Accept(ForStatement forStmt)
 {
     errorLog.AddError (ErrorType.ParserError, forStmt.Location,
         "Statement not allowed outside function body!");
 }
Exemplo n.º 8
0
 public void Accept(ForStatement forStmt)
 {
 }