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

Buzz programming language syntax #3282

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
48 changes: 48 additions & 0 deletions runtime/syntax/buzz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
filetype: buzz

detect:
filename: "\\.buzz$"

rules:
# keywords
- statement: "\\b(range|namespace|typeof|type|zdef|void|static|var|const|extern|import|export|from|test|as|in|while|if|else|fun|try|catch|throw|constructor|return|switch|default|break|for|foreach|do|until|continue|resolve|resume|yield|any|out)\\b"
# special method names
- symbol.operator: "\\b(!|and|or|band|bor|xor|\\?\\?)\\b"
# definitions
- identifier: "def [a-zA-Z_0-9]+"
# keywords (declaration)
- statement: "\\b(enum|object|protocol)\\b"
# constants (true, false, null, this)
- constant: "\\b(true|false|null|this)\\b"
# constants (types)
- type: "\\b(ud|str|int|float|obj|fib|bool|pat|type|any)\\b\\??"
# parentheses
- symbol.brackets: "([(){}]|\\[|\\])"
# extra operators
- symbol.operator: "(\\+|\\-|\\/|%|\\*|>>|<<|\\\\|\\^|&|~|!>)"
# Comparision operators
- symbol.operator: "(==|!=|<=?|>=?|\\bis\\b|\\?\\?)"
# numbers
- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal
- constant.number: "\\b0b(_?[01])+\\b" # bin
- constant.number: "\\b0x(_?[0-9a-fA-F])+\\b" # hex

- constant.string:
start: "\""
end: "(\"|$)"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."

- constant.string:
start: "'"
end: "('|$)"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."

- comment:
start: "\\|"
end: "$"
rules:
- todo: "(TODO|FIXME|HACK|BUG|NOTE|FAQ|MNEMONIC|REQ|RFE|IDEA|PORT|\\?\\?\\?|!!!|GLOSS|SEE|TODOC|STAT|RVD|CRED):?"