-
Notifications
You must be signed in to change notification settings - Fork 1.3k
syntax: add Gleam language support #4045
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
Changes from 2 commits
e19c021
992f30c
aa2c965
b6657ad
5f594d1
c733704
6357c79
4367c87
3338524
fefa5d9
da797ea
0700b34
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,19 @@ | ||||||||||||
| filetype: gleam | ||||||||||||
|
|
||||||||||||
| detect: | ||||||||||||
| filename: "\\.gleam$" | ||||||||||||
|
|
||||||||||||
| rules: | ||||||||||||
| - statement: "\\b(fn|let|case|if|use|import|pub|type|opaque|const|as|assert|panic|todo|echo)\\b" | ||||||||||||
| - identifier: "\\b(Int|Float|String|Bool|List|Option|Result|Nil|BitArray)\\b" | ||||||||||||
| - constant: "\\b(True|False|Nil)\\b" | ||||||||||||
| - operator: "(\\|>|->|<>|==|!=|<=|>=|&&|\\|\\|)" | ||||||||||||
|
Contributor
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. Most syntaxes choose to use
Contributor
Author
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. Hi @Andriamanitra , thanks for the great feedback! I've pushed a new commit that addresses all your points: Rule Overlap: Moved the base identifier rule to the top, so the specific type and constant rules below it can correctly overwrite it. Built-in Types: Removed Nil from the built-in types list (kept it under constants). Operators: Moved operators to statement so they highlight correctly, and added the missing arithmetic, assignment, and Gleam-specific float operators. Numbers: Implemented the robust number regexes from the Python syntax file to handle binary, octal, hex, and scientific notation floats. Attributes: Added a preproc rule (@[a-zA-Z0-9_]+) to highlight attributes like @external and @deprecated. |
||||||||||||
| - comment: | ||||||||||||
| start: "//" | ||||||||||||
| end: "$" | ||||||||||||
| - string: | ||||||||||||
| start: "\"" | ||||||||||||
| end: "\"" | ||||||||||||
| skip: "\\\\." | ||||||||||||
| - special: "\\b[0-9]+\\.?[0-9]*\\b" | ||||||||||||
|
Contributor
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. Numbers should be micro/runtime/syntax/python3.yaml Lines 28 to 32 in 42d0ddf
Footnotes |
||||||||||||
| - type: "\\b[A-Z][a-zA-Z0-9_]*\\b" | ||||||||||||
|
Contributor
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. This overlaps with the definitions for |
||||||||||||
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.
I would remove
Nilfrom here since it's also inconstant.