Kajetan Johannes Hammerle 7 年之前
父節點
當前提交
6000e94de6
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 2 1
      src/me/hammerle/code/LineCompiler.java
  2. 5 1
      src/me/hammerle/snuviscript/SnuviScript.java

+ 2 - 1
src/me/hammerle/code/LineCompiler.java

@@ -67,7 +67,7 @@ public class LineCompiler
                 else if(syntax.isIncOrDec())
                 {
                     Code change = co.get(co.size() - 1);
-                    if(change.function.equals("array.get"))
+                    if("array.get".equals(change.function))
                     {
                         change.function = "array." + syntax.getFunction();
                     }
@@ -148,6 +148,7 @@ public class LineCompiler
                         minus = false;
                         if(line.startsWith("()", pos + 1))
                         {
+                            commaCounter.pop();
                             co.add(new Code(s, 0, realLine, layer));
                         }
                         else

+ 5 - 1
src/me/hammerle/snuviscript/SnuviScript.java

@@ -61,7 +61,11 @@ public class SnuviScript
         parser.registerConsumer("print", (o, sc) -> System.out.println(o[0]));
         parser.registerFunction("get", (o, sc) -> new Fraction(1));
             
-        String s = "print(1, -1, 1);";
+        String s = "i = 0;\n" +
+            "while(i++ < 3) {\n" +
+            "  print(i);\n" +
+            "}\n" +
+            "term();";
         System.out.println(s);
         System.out.println();
         try