-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Symmettry/master
Actual .java implementation, make js.lua better, json.lua
- Loading branch information
Showing
3 changed files
with
156 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
highlight("package", "reserved") | ||
highlight("import", "reserved") | ||
|
||
highlight("public", "reserved") | ||
highlight("private", "reserved") | ||
highlight("protected", "reserved") | ||
|
||
highlight("class", "reserved") | ||
highlight("enum", "reserved") | ||
highlight("record", "reserved") | ||
highlight("interface", "reserved") | ||
|
||
highlight("extends", "reserved") | ||
highlight("implements", "reserved") | ||
highlight("module", "reserved") | ||
|
||
highlight("super", "reserved") | ||
highlight("this", "reserved") | ||
|
||
highlight("void", "reserved") | ||
highlight("boolean", "reserved") | ||
highlight("int", "reserved") | ||
highlight("double", "reserved") | ||
highlight("long", "reserved") | ||
highlight("float", "reserved") | ||
highlight("char", "reserved") | ||
highlight("byte", "reserved") | ||
highlight("short", "reserved") | ||
|
||
-- which mf actually uses these | ||
highlight("const", "reserved") | ||
highlight("goto", "reserved") | ||
highlight("strictfp", "reserved") | ||
|
||
highlight("instanceof", "reserved") | ||
highlight("native", "reserved") | ||
highlight("new", "reserved") | ||
|
||
highlight("return", "reserved") | ||
|
||
highlight("final", "reserved") | ||
highlight("static", "reserved") | ||
highlight("transient", "reserved") | ||
highlight("volatile", "reserved") | ||
|
||
highlight_region("\"", "\"", "string") | ||
highlight_region("//", "", "comments", true) | ||
highlight_region("/*", "*/", "comments") | ||
|
||
-- annotation but ofc griddy doesn't let me set keywords outside of default ones | ||
highlight_region("@", "", "comments", true) | ||
|
||
highlight("if", "reserved") | ||
highlight("else", "reserved") | ||
|
||
highlight("do", "reserved") | ||
highlight("while", "reserved") | ||
highlight("for", "reserved") | ||
highlight("continue", "reserved") | ||
highlight("default", "reserved") | ||
highlight("break", "reserved") | ||
|
||
highlight("switch", "reserved") | ||
highlight("case", "reserved") | ||
|
||
highlight("try", "reserved") | ||
highlight("catch", "reserved") | ||
highlight("finally", "reserved") | ||
highlight("throw", "reserved") | ||
highlight("throws", "reserved") | ||
|
||
highlight("false", "binary") | ||
highlight("true", "binary") | ||
highlight("null", "binary") | ||
|
||
highlight("synchronized", "reserved") | ||
|
||
highlight("assert", "reserved") | ||
|
||
highlight("exports", "reserved") | ||
highlight("module", "reserved") | ||
highlight("non-sealed", "reserved") | ||
highlight("open", "reserved") | ||
highlight("opens", "reserved") | ||
highlight("permits", "reserved") | ||
highlight("provides", "reserved") | ||
highlight("requires", "reserved") | ||
highlight("sealed", "reserved") | ||
highlight("to", "reserved") | ||
highlight("transitive", "reserved") | ||
highlight("uses", "reserved") | ||
highlight("var", "reserved") | ||
highlight("when", "reserved") | ||
highlight("with", "reserved") | ||
highlight("yield", "reserved") | ||
|
||
add_comment("boiler plate alert!!!") | ||
add_comment("public static volatile transient transitive synchronized class type language 🗣️🔥") | ||
add_comment("another semicolon please") | ||
add_comment("use a lambda you dumbass") | ||
|
||
function detect_functions(content) | ||
local functionNames = {} | ||
|
||
for line in content:gmatch("[^\r\n]+") do | ||
local pattern = "[%a_][%a%d_<>]*%s+([%a_][%a%d_]*)%s*%(" | ||
local functionName = line:match(pattern) | ||
if functionName then | ||
table.insert(functionNames, functionName); | ||
end | ||
end | ||
|
||
return functionNames | ||
end | ||
|
||
function detect_variables(content) | ||
local variable_names = { | ||
"this", | ||
"super", | ||
"System", | ||
"Object", | ||
"Math", | ||
"Thread", | ||
"Runtime" | ||
} | ||
for line in content:gmatch("[^\r\n]+") do | ||
local pattern = "%f[%a_][%a_][%a%d_<>]*%s+([%a_][%a%d_<>]*)%s*=%s*[^;]+;" | ||
local match = line:match(pattern) | ||
if match then | ||
table.insert(variable_names, match) | ||
end | ||
end | ||
return variable_names | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
highlight_region('"', '"', "string") | ||
|
||
add_comment("object notation 💯🔥") | ||
add_comment("lower that scope") | ||
add_comment("🗣️🗣️🗣️ { \"i'm\": \"suiciding\" }") | ||
|
||
-- json doesn't have variables or functions |