Пример #1
0
        public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
        {
            context.Indentation++;
            textWriter.Write("for (var ");
            _assignment.GenerateJavaScript(context, textWriter);
            textWriter.Write(" ");

            GeneratorHelper.GenerateNode(context, textWriter, _assignment.Variable);

            if (_step > 0)
            {
                textWriter.Write("<=");
            }
            else if (_step < 0)
            {
                textWriter.Write(">=");
            }
            else
            {
                throw new BasicSyntaxErrorException("A step amount of 0 is not allowed.");
            }


            _upperBound.GenerateJavaScript(context, textWriter);
            textWriter.Write("; ");
            GeneratorHelper.GenerateNode(context, textWriter, _assignment.Variable);
            textWriter.Write(" += " + _step);

            textWriter.Write(") {");
        }
Пример #2
0
 public override void GenerateJavaScript(JSContext context, TextWriter textWriter)
 {
     textWriter.Write("console.setCursorPos(");
     GeneratorHelper.GenerateNode(context, textWriter, TargetRow);
     textWriter.Write(", ");
     GeneratorHelper.GenerateNode(context, textWriter, TargetColumn);
     textWriter.Write(");");
 }
Пример #3
0
        public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
        {
            GeneratorHelper.GenerateNode(context, textWriter, _variable);
            textWriter.Write("= console.input(");

            if (_toPrint != null)
            {
                _toPrint.GenerateJavaScript(context, textWriter);
            }

            textWriter.Write(");");
        }
Пример #4
0
 private static void Write(JSContext context, TextWriter textWriter, params object[] values)
 {
     foreach (object val in values)
     {
         if (val is AstNode)
         {
             textWriter.Write("(");
             GeneratorHelper.GenerateNode(context, textWriter, (AstNode)val);
             textWriter.Write(")");
         }
         else
         {
             textWriter.Write(val);
         }
     }
 }
Пример #5
0
 public override void GenerateJavaScript(JSContext context, TextWriter textWriter)
 {
     textWriter.Write("tempVar = ");
     GeneratorHelper.GenerateNode(context, textWriter, Variable1);
     textWriter.WriteLine(";");
     textWriter.Write(context.IndentationText);
     GeneratorHelper.GenerateNode(context, textWriter, Variable1);
     textWriter.Write(" = ");
     GeneratorHelper.GenerateNode(context, textWriter, Variable2);
     textWriter.WriteLine(";");
     textWriter.Write(context.IndentationText);
     GeneratorHelper.GenerateNode(context, textWriter, Variable2);
     textWriter.WriteLine(" = tempVar;");
     textWriter.Write(context.IndentationText);
     textWriter.Write("tempVar = null;");
 }
Пример #6
0
 public virtual void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
 {
     GeneratorHelper.GenerateNodes(context, textWriter, ChildNodes);
 }
Пример #7
0
 public override void GenerateJavaScript(JSContext context, System.IO.TextWriter textWriter)
 {
     GeneratorHelper.GenerateNodes(context, textWriter, ChildNodes);
     textWriter.Write(";");
 }