Commit graph

48 commits

Author SHA1 Message Date
Bruno BELANYI 82bbebeeb5 Inline '_function_declaration_common'
This is purely an de-duplication rule, we don't need to make it part of
the parse tree.
2022-06-03 10:59:54 +02:00
Bruno BELANYI 0b549493a2 Add identifiers high-lighting
We now make use of the more specific '_type_identifier' and
'_field_identifier' rules!
2022-06-03 10:44:10 +02:00
Bruno BELANYI da494122ea Replace '_typed_field' by more specific grammar
Instead of re-using a common rule, inline its definition and use
'_field_identifier' where appropriate.

This is useful for more accurate high-lighting.
2022-06-03 10:40:14 +02:00
Bruno BELANYI 5d37bf7bd1 Use 'type_identifier' in array type declaration 2022-06-03 10:35:53 +02:00
Bruno BELANYI 0827093fe7 Add 'field_identifier' alias
This will be useful for high-lighting.
2022-06-03 10:31:30 +02:00
Bruno BELANYI abe5b2e366 Add 'misc' grouping 2022-06-03 10:16:44 +02:00
Bruno BELANYI 2be5056793 Add 'type_identifier' alias
This is more appropriate, and actually closer to the specified grammar.
2022-06-03 10:15:40 +02:00
Bruno BELANYI 6e40691a35 Add operators highlighting 2022-06-03 10:08:58 +02:00
Bruno BELANYI d83fa3acb7 Add keywords highlighting 2022-06-02 22:27:58 +02:00
Bruno BELANYI 751929a058 Fix whitespace skipping in scanner
Once again, implicit fall-through is the devil.
2022-06-02 22:27:13 +02:00
Bruno BELANYI 61f03a116c Add additional test for comments 2022-06-02 22:20:37 +02:00
Bruno BELANYI b836117a21 Add literals highlighting 2022-06-02 22:20:37 +02:00
Bruno BELANYI b9376ccd35 Add comment syntax highlighting 2022-06-02 22:20:37 +02:00
Bruno BELANYI 84d25af8d5 Add language information to 'package.json'
Apparently this is needed by the 'tree-sitter' tooling for syntax
highlighting.
2022-06-02 22:20:37 +02:00
Bruno BELANYI 5866cd4a82 Add 'tree-sitter' pre-commit hook
Make sure you don't break anything when committing.
2022-06-02 22:20:37 +02:00
Bruno BELANYI b3e91d9aad Add 'tree-sitter-files' pre-commit hook
This is too ensure that generated files are always in lock-step with the
grammar.
2022-06-02 22:20:37 +02:00
Bruno BELANYI 8f752e0f94 Add 'clang-format' pre-commit hook 2022-06-02 22:20:37 +02:00
Bruno BELANYI 5be01b43fb Add clang-format rules
Since we now have an external scanner, might as well have good looking
code.
2022-06-02 22:20:37 +02:00
Bruno BELANYI 50a0eaa071 Add support for nested comments
Unfortunately, the 'extras' array expects single tokens only, so one
can't really use a recursive parsing rule to express nesting comments...
2022-06-02 22:20:37 +02:00
Bruno BELANYI 75bb2c7009 Add comments
For now it only supports non-nested comments. It seems like I *will*
need to write an external lexer to account for nesting properly.
2022-06-02 17:07:30 +02:00
Bruno BELANYI e5e958cac9 Add tests for sequence expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI e59aeed31a Remove nested 'parameters' field
The 'parameters' production rule does not need itself to have a
'parameters' field, this is redundant information.
2022-06-02 17:07:30 +02:00
Bruno BELANYI 76b558a982 Add return type to function declarations 2022-06-02 17:07:30 +02:00
Bruno BELANYI 1e5f7cd5d5 Add array types 2022-06-02 17:07:30 +02:00
Bruno BELANYI dd0af53fa0 Add record types 2022-06-02 17:07:30 +02:00
Bruno BELANYI 506fab8896 Add type declarations
For now, simplified to type aliases only.
2022-06-02 17:07:30 +02:00
Bruno BELANYI e898312c95 Add function declarations 2022-06-02 17:07:30 +02:00
Bruno BELANYI 3eb6b0a0d0 Add variable declarations 2022-06-02 17:07:30 +02:00
Bruno BELANYI 3cf701dbb1 Add top-level declarations 2022-06-02 17:07:30 +02:00
Bruno BELANYI 1449aa939f Add let expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI 68aac9a0ae Delineate expressions in grammar 2022-06-02 17:07:30 +02:00
Bruno BELANYI d32fd4fd6c Add break expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI bb6875a11d Add for expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI 26999482a3 Add while expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI 19c1f11414 Add if expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI 93cd163707 Add assignment expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI 6a3e4663ed Add lvalue expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI 8921953bbb Add function calls 2022-06-02 17:07:30 +02:00
Bruno BELANYI 136924cb26 Add record expression 2022-06-02 17:07:30 +02:00
Bruno BELANYI babf666642 Add array expression 2022-06-02 17:07:30 +02:00
Bruno BELANYI 02f83784b1 Use explicit 'nil_literal' rule
Makes the dumped AST more readable, and will probably help in writing
future queries.
2022-06-02 17:07:30 +02:00
Bruno BELANYI 0bc7e59fc7 Disable keyword extraction
For now bare keywords are errors, since we have not included them as
valid expressions.
2022-06-02 17:07:30 +02:00
Bruno BELANYI 50c8e3c0e6 Centralise precedence values
Makes it easier to ensure correct precedence relative to the rest of the
grammar later on.
2022-06-02 17:07:30 +02:00
Bruno BELANYI 03fa0427cf Add arithmetic expressions 2022-06-02 17:07:30 +02:00
Bruno BELANYI e7ba93870e Add simple atoms 2022-06-01 22:19:04 +02:00
Bruno BELANYI 30b2e50367 Bootstrap tree-sitter parser architecture 2022-06-01 16:39:18 +02:00
Bruno BELANYI 4b1d0f7744 Ignore nix-generated files 2022-06-01 16:23:17 +02:00
Bruno BELANYI 00f3013af0 Bootstrap nix flake environment 2022-06-01 16:23:17 +02:00