use of priv.bajdcc.LALR1.grammar.runtime.data.RuntimeMap in project jMiniLang by bajdcc.
the class ModuleList method getCodePage.
@Override
public RuntimeCodePage getCodePage() throws Exception {
if (runtimeCodePage != null)
return runtimeCodePage;
String base = ResourceLoader.load(getClass());
Grammar grammar = new Grammar(base);
RuntimeCodePage page = grammar.getCodePage();
IRuntimeDebugInfo info = page.getInfo();
info.addExternalValue("g_new_array", () -> new RuntimeObject(new RuntimeArray()));
info.addExternalValue("g_new_map", () -> new RuntimeObject(new RuntimeMap()));
buildMethod(info);
return runtimeCodePage = page;
}
use of priv.bajdcc.LALR1.grammar.runtime.data.RuntimeMap in project jMiniLang by bajdcc.
the class ModuleNet method parseInternal.
private static RuntimeObject parseInternal(Object o) {
if (o instanceof JSONObject) {
JSONObject obj = (JSONObject) o;
RuntimeMap map = new RuntimeMap();
obj.forEach((key, value) -> {
map.put(key, parseInternal(value));
});
return new RuntimeObject(map);
} else if (o instanceof JSONArray) {
JSONArray obj = (JSONArray) o;
RuntimeArray arr = new RuntimeArray();
obj.forEach((key) -> {
arr.add(parseInternal(key));
});
return new RuntimeObject(arr);
} else {
return new RuntimeObject(o);
}
}
use of priv.bajdcc.LALR1.grammar.runtime.data.RuntimeMap in project jMiniLang by bajdcc.
the class RuntimeMachine method opMap.
@Override
public void opMap() throws RuntimeException {
int size = current();
next();
RuntimeMap map = new RuntimeMap();
for (int i = 0; i < size; i++) {
map.put(loadString(), load());
}
stack.pushData(new RuntimeObject(map));
}
Aggregations