public static GenerateNode ( |
||
context | ||
textWriter | ||
node | AstNode | |
리턴 | void |
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(") {"); }
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(");"); }
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(");"); }
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); } } }
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;"); }