com.jtransc.media.limelibgdx.util.Operators Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gdx-backend-jtransc Show documentation
Show all versions of gdx-backend-jtransc Show documentation
JVM AOT compiler currently generating JavaScript, Haxe, with initial focus on Kotlin and games.
package com.jtransc.media.limelibgdx.util;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Operators {
static public HashMap BINOPS = constructOperators(new String[][]{
new String[] { "=" },
new String[] { "*", "/", "%" },
new String[] { "+", "-" },
new String[] { "<<", ">>", ">>>" },
new String[] { "<", ">", "<=", ">=" },
new String[] { "==", "!=" },
new String[] { "&" },
new String[] { "^" },
new String[] { "|" },
new String[] { "&&" },
new String[] { "||" },
});
static public HashMap UNOPS = constructOperators(new String[][]{
new String[] { "!" },
new String[] { "~" },
new String[] { "++" },
new String[] { "--" },
new String[] { "-" },
new String[] { "+" },
});
static public HashMap SYMBOLS = constructOperators(new String[][]{
new String[] { "(", ")" },
new String[] { "[", "]" },
new String[] { "{", "}" },
new String[] { "." },
new String[] { "," },
new String[] { ";" },
new String[] { "//", "/*", "*/" }, // Comments
});
static public final Set ALL = new HashSet() {{
addAll(Operators.SYMBOLS.keySet());
addAll(Operators.BINOPS.keySet());
addAll(Operators.UNOPS.keySet());
}};
static private HashMap constructOperators(String[][] opsList) {
HashMap out = new HashMap<>();
int priority = 0;
for (String[] ops : opsList) {
for (String op : ops) {
out.put(op, priority);
}
priority++;
}
return out;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy