Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MonkeyC syntax highlighting. #506

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

koutsie
Copy link

@koutsie koutsie commented Jan 9, 2025

Add syntax highlighting for Garmins MonkeyC language

@adamharrison
Copy link
Member

Looks good; can you add the appropriate entry to manifest.json, so it can be picked up by our CI and automated package managers?

@koutsie
Copy link
Author

koutsie commented Jan 14, 2025

Done, thanks - didn't catch that haha.

Comment on lines +61 to +77
-- operators
["+"] = "operator",
["-"] = "operator",
["*"] = "operator",
["/"] = "operator",
["%"] = "operator",
["++"] = "operator",
["--"] = "operator",
["=="] = "operator",
["!="] = "operator",
[">"] = "operator",
["<"] = "operator",
[">="] = "operator",
["<="] = "operator",
["&&"] = "operator",
["||"] = "operator",
["!"] = "operator"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already covered by line 19, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me actually make this part regexless, you are right.

{ pattern = "-?%.?%d+", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = "[%a_][%w_]*%f[(]", type = "function" },
{ regex = "[A-Z][A-Z_]+", type = "keyword2" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to have this as regex, it can be exactly the same with pattern.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know that when I looked at language_java.lua haha

Copy link
Contributor

@PerilousBooklet PerilousBooklet Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, when using regex we should always use [[regex_pattern_here]] instead of "regex_pattern_here".

@@ -125,6 +125,7 @@
"language_marte": {},
"language_meson": {},
"language_miniscript": {},
"language_monkeyc": {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also bump the version of meta_languages.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta_languages in the manifest itself, yeah?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

syntax.add {
name = "MonkeyC",
files = { "%.mc$", "%.mciq$" },
comment = "//",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
comment = "//",
comment = "//",
block_comment = { "/*", "*/" },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants