Beispiel #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;
 }
Beispiel #2
0
 public void Accept(ForStatement forStmt)
 {
     forStmt.Visit (functionCompiler);
 }
		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 ();
		}
		public override void Accept (ForStatement forStmt)
		{
			errorLog.AddError (ErrorType.ParserError, forStmt.Location,
				"statement can not exist inside pattern!");
		}
 public virtual void Accept(ForStatement forStmt)
 {
 }
Beispiel #6
0
 public void Accept(ForStatement forStmt)
 {
     forStmt.VisitChildren (this);
 }
Beispiel #7
0
 public void Accept(ForStatement forStmt)
 {
     errorLog.AddError (ErrorType.ParserError, forStmt.Location,
         "Statement not allowed outside function body!");
 }
Beispiel #8
0
 public void Accept(ForStatement forStmt)
 {
 }