Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions runtime/syntax/mcfunction.yaml
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|$).*$"

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

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 numerical to number.

It should be ok :))
Thank you.


# === 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: "[{}\\[\\](),=]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 constant.number😅😅😅

Suggested change
- constant.numeric: "\\b-?[0-9]+(?:\\.[0-9]+)?\\b"
- constant.number: "\\b-?[0-9]+(?:\\.[0-9]+)?\\b"

BTW if change constant.numeric to constant.number, it works perfectly. I really like this change

IMG_20260518_125643.jpg

- constant.bool: "\\b(true|false)\\b"
- constant.string: "\"([^\"\\\\]|\\\\.)*\""