Ver código fonte

case insensitive functions

Kajetan Johannes Hammerle 5 anos atrás
pai
commit
7e3a3bda1f
2 arquivos alterados com 2 adições e 8 exclusões
  1. 1 1
      src/me/hammerle/snuviscript/code/Compiler.java
  2. 1 7
      test.sbasic

+ 1 - 1
src/me/hammerle/snuviscript/code/Compiler.java

@@ -223,7 +223,7 @@ public class Compiler
                             {
                                 throw new PreScriptException("missing function syntax", line);
                             }
-                            currentFunction = check.substring(9, index);
+                            currentFunction = check.substring(9, index).toLowerCase();
                             functions.put(currentFunction, code.size());
                             localLabels.put(currentFunction, new HashMap<>());
                             int endIndex = check.indexOf(")", index);

+ 1 - 7
test.sbasic

@@ -1,7 +1 @@
-array.new(a[4]);
-a[0] = 1;
-a[1] = 2;
-a[2] = 3;
-a[3] = 4;
-
-print(a);
+command("heal ", player.getName(player));