-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Added syntax support for .mcfunction files (Minecraft functions) #3953
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| filetype: mcfunction | ||||||
|
|
||||||
| detect: | ||||||
| filename: "\\.mcfunction$" | ||||||
|
|
||||||
| rules: | ||||||
| # === COMMENTS === | ||||||
| - comment: | ||||||
| start: "(^|\\s)#" | ||||||
| end: "$" | ||||||
| rules: [] | ||||||
|
|
||||||
| # === DANGEROUS COMMANDS === | ||||||
| - error: "^\\s*(kill|tp|teleport)\\s+@([ae])(\\s|$).*$" | ||||||
|
|
||||||
| # === JSON KEYS === | ||||||
| - special: "\"(text|color|bold|italic|underlined|strikethrough|obfuscated|extra|translate|with|score|name|objective)\"\\s*:" | ||||||
|
|
||||||
| # === ENTITY / SELECTORS === | ||||||
| - type: "@[pares]" | ||||||
| - special: "@[pares]\\[[^\\]]*\\]" | ||||||
|
|
||||||
| # === AXES === | ||||||
| - special: "[~^]" | ||||||
|
|
||||||
| # === IDENTIFIERS === | ||||||
| - identifier: "\\bminecraft:[a-z0-9_./]+\\b" | ||||||
| - identifier: "\\b[a-z0-9_]+:[a-z0-9_./]+\\b" | ||||||
|
|
||||||
| # === EFFECTS === | ||||||
| - constant: "\\b(speed|slowness|haste|mining_fatigue|strength|instant_health|instant_damage|jump_boost|nausea|regeneration|resistance|fire_resistance|water_breathing|invisibility|blindness|night_vision|hunger|weakness|poison|wither|health_boost|absorption|saturation|glowing|levitation|luck|unluck|slow_falling|conduit_power|dolphins_grace|bad_omen|hero_of_the_village|darkness)\\b" | ||||||
|
|
||||||
| # === MAIN COMMANDS === | ||||||
| - statement: "\\b(effect|execute|item|scoreboard|data|tag|tp|teleport|give|say|tellraw|summon|kill|function|schedule|loot|damage|attribute|bossbar|title|particle|playsound|stopsound|fill|setblock|clone|clear)\\b" | ||||||
|
|
||||||
| # === SUBCOMMANDS === | ||||||
| - preproc: "\\b(give|clear|run|if|unless|store|as|at|positioned|facing|align|anchored|rotated|matches|modify|merge|get|set|add|remove|append|prepend|insert|entity|block|storage)\\b" | ||||||
|
|
||||||
| # === SCORE / CONDITIONS === | ||||||
| - special: "\\b(score|scores|range|limit|distance|dx|dy|dz|x|y|z|level|sort|type|name|team|tag)\\b" | ||||||
|
|
||||||
| # === SLOTS === | ||||||
| - identifier: "\\b[a-z0-9_]+:(mainhand|offhand|head|chest|legs|feet)\\b" | ||||||
|
|
||||||
| # === SYMBOLS === | ||||||
| - symbol: "[{}\\[\\](),=]" | ||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A blank line. Not critical, but a tiny little bit weird |
||||||
|
|
||||||
| # === DANGEROUS COMMANDS === | ||||||
| - error: "^\\s*(kill|tp|teleport)\\s+@([ae])(\\s|$).*$" | ||||||
|
|
||||||
| # === CONSTANTS === | ||||||
| - constant.numeric: "\\b-?[0-9]+(?:\\.[0-9]+)?\\b" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for being misleading in my previous review, actually the convenient rule is
Suggested change
BTW if change |
||||||
| - constant.bool: "\\b(true|false)\\b" | ||||||
| - constant.string: "\"([^\"\\\\]|\\\\.)*\"" | ||||||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one seems to have no effect, as it is repeated on lines 49-50. I suggest to remove it completely, while leaving the one at lines 49-50 untouched
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That junk on lines 13 and 14 is artifacts, sorry. I copied it from place to place and didn't clean it up.
I corrected
numericaltonumber.It should be ok :))
Thank you.