Пример #1
0
		protected override void TranslateWhileLoop(List<string> output, WhileLoop whileLoop)
		{
			output.Add(this.CurrentTabIndention);
			output.Add("while ");
			this.TranslateExpression(output, whileLoop.Condition);
			output.Add(":\r\n");
			this.CurrentIndention++;
			this.Translate(output, whileLoop.Code);
			this.CurrentIndention--;
		}
Пример #2
0
		protected override void TranslateWhileLoop(List<string> output, WhileLoop whileLoop)
		{
			output.Add(this.CurrentTabIndention);
			output.Add(this.Shorten("while ("));
			this.TranslateExpression(output, whileLoop.Condition);
			if (this.isEgyptian)
			{
				output.Add(this.Shorten(") {") + this.NL);
			}
			else
			{
				output.Add(")");
				output.Add(this.NL);
				output.Add(this.CurrentTabIndention);
				output.Add("{");
				output.Add(this.NL);
			}
			this.CurrentIndention++;
			this.Translate(output, whileLoop.Code);
			this.CurrentIndention--;
			output.Add(this.CurrentTabIndention);
			output.Add("}" + this.NL);
		}
Пример #3
0
		private void CompileWhileLoop(Parser parser, ByteBuffer buffer, WhileLoop whileLoop)
		{
			ByteBuffer loopBody = new ByteBuffer();
			this.Compile(parser, loopBody, whileLoop.Code);
			ByteBuffer condition = new ByteBuffer();
			this.CompileExpression(parser, condition, whileLoop.Condition, true);

			condition.Add(whileLoop.Condition.FirstToken, OpCode.JUMP_IF_FALSE, loopBody.Size + 1);
			condition.Concat(loopBody);
			condition.Add(null, OpCode.JUMP, -condition.Size - 1);

			condition.ResolveBreaks();
			condition.ResolveContinues();

			buffer.Concat(condition);
		}
Пример #4
0
		protected abstract void TranslateWhileLoop(List<string> output, WhileLoop whileLoop);