Skip to content

Commit

Permalink
enh(nix): major improvements to grammar (#4140)
Browse files Browse the repository at this point in the history
* nix: add function type, import regex library

* nix: update keywords

- Add a bunch of new keywords
- List all `builtins` explicitly
- Sort alphabetically, to make it easier to spot missing builtins
- Remove `add`, not a real builtin
- Move `or` to `keywords`, this is not a `literal`

* nix: fix string handling

- The different string variants have different modes of escapes.
  Split `STRING.contains` into their different variants to reflect this.
- Add escape logic for `'''`
- Add escape logic for backslash escaped characters.

* nix: handle path, lookup paths, and operators

* nix: handle markdown comments

Also ensure comments are handled before any other expressions

* nix: handle REPL keywords

* nix: handle basic function params

* nix: better parsing for attrsets

* nix: update tests

* CHANGES.md: update with changes to nix
  • Loading branch information
h7x4 authored Oct 31, 2024
1 parent 0dd843b commit 347c462
Show file tree
Hide file tree
Showing 4 changed files with 506 additions and 56 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,26 @@ Core Grammars:
- enh(csharp) add Contextual keywords `file`, `args`, `dynamic`, `record`, `required` and `scoped` [Alvin Joy][]
- enh(lua) add 'pluto' as an alias [Sainan]
- enh(bash) add reserved keywords `time` and `coproc` [Álvaro Mondéjar][]
- enh(nix) update keywords [h7x4][]
- enh(nix) support paths [h7x4][]
- enh(nix) support lookup paths [h7x4][]
- enh(nix) support operators [h7x4][]
- enh(nix) support REPL keywords [h7x4][]
- enh(nix) support markdown comments [h7x4][]
- enh(nix) support basic function params [h7x4][]
- enh(nix) better parsing of attrsets [h7x4][]
- fix(c) - Fixed hex numbers with decimals [Dxuian]
- fix(typescript) - Fixedoptional property not highlighted correctly [Dxuian]
- fix(ruby) - fix `|=` operator false positives (as block arguments) [Aboobacker MK]
- fix(sql) - Fixed sql primary key and foreign key spacing issue [Dxuian]
- fix(cpp) added flat_set and flat_map as a part of cpp 23 version [Lavan]
- fix(yaml) - Fixed special chars in yaml [Dxuian]
- fix(basic) - Fixed closing quotation marks not required for a PRINT statement [Somya]
- fix(nix) remove `add` builtin [h7x4][]
- fix(nix) mark `or` as builtin instead of literal [h7x4][]
- fix(nix) handle `'''` string escapes [h7x4][]
- fix(nix) handle backslash string escapes [h7x4][]
- fix(nix) don't mix escapes for `"` and `''` strings [h7x4][]
- fix(swift) - Fixed syntax highlighting for class func/var declarations [guuido]

New Grammars:
Expand Down
Loading

0 comments on commit 347c462

Please sign in to comment.