Kajetan Johannes Hammerle il y a 7 ans
Parent
commit
6000e94de6

+ 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