Commit Graph

68 Commits (5efbe4fdf199f30a90393196bfbf842d866753c2)

Author SHA1 Message Date
GearsDatapacks 5efbe4fdf1 Generate parser 2025-04-21 11:13:08 +07:00
GearsDatapacks ae4adef5cc Generate parser 2025-04-19 14:43:34 +07:00
Alex Manning af6043419f Generate parser 2025-02-07 14:27:03 +07:00
Gears 066704e482 Generate parser 2024-11-26 00:35:28 +07:00
Giacomo Cavalieri 2702fe84b9 Generate parser 2024-10-30 19:13:15 +07:00
Giacomo Cavalieri 426e67087f Generate parser 2024-07-25 20:15:42 +07:00
Alex Manning a0b11a1593 Generate parser 2024-04-23 15:23:02 +07:00
Michael Davis 3479db3d20 Generate parser 2023-12-06 23:57:48 +07:00
Michael Davis 11db86c2a0 Generate parser 2023-12-06 23:13:10 +07:00
Michael Davis 152e0d6953 Generate parser 2023-11-08 15:21:18 +07:00
Michael Davis b7ae2c9374 Generate parser 2023-11-03 16:29:47 +07:00
Michael Davis 399172f660 Generate parser 2023-10-29 16:12:12 +07:00
Michael Davis a14043278d Generate parser 2023-10-29 16:04:59 +07:00
Michael Davis 7cc7702f2e Generate parser 2023-08-28 00:10:56 +07:00
Michael Davis 0042037c31 Generate parser 2023-08-28 00:08:58 +07:00
Michael Davis e8feaf9491 Generate parser 2023-08-27 23:45:04 +07:00
Alex Manning 80ae1e8de4 Generate parser 2023-07-29 21:00:46 +07:00
Jonathan Arnett 4a3bae27c7 Add integer negation 2023-07-29 19:17:09 +07:00
Jonathan Arnett d06bad63d7 Rename "expression_group" to "block" 2023-07-29 19:16:16 +07:00
Jonathan Arnett cd03a61878 Make "let assert" a statement instead of an expression
This makes me a little uneasy, as the way that the Gleam parser parses
"let assert" is that it first parses "let", then calls
"parse_assignment" which will look to see if an "assert" comes next,
and uses this information to choose the node type.

I think a closer tree-sitter implementation would look like this:

_statement: ($) => choice($._expression, $._assignment, $.use),
...
_assignment: ($) => choice($.let, $.let_assert),
let: ($) => seq("let", $._assignment2),
let_assert: ($) => seq("let", "assert", $._assignment2)
_assignment2: ($) =>
  ...

However this requires an awkward "_assignment2" and isn't
substantially closer to the Gleam parser to warrant the change.

Also we could simply do `optional("assert")`, but that would make
"let" and "let assert" the same node type, which I suspect is an anti-feature.
2023-07-29 19:15:21 +07:00
Michael Davis 31418e5219 Generate parser 2023-04-07 14:58:28 +07:00
inoas 2914d3b437
add `let assert` alt impl (#50) 2023-03-03 16:24:16 +07:00
inoas d14acab7f2
add `panic` keyword / add contributing section to Readme (#46) 2023-03-03 11:38:22 +07:00
Michael Davis c72df7110b Generate parser 2023-03-03 04:26:12 +07:00
Michael Davis 8df06b69b0
Parse 'use' expressions (#42) 2022-11-23 14:03:22 +07:00
Michael Davis e21567343e
Support v0.24 binary concatenation operator (#39) 2022-10-27 23:54:52 +07:00
Jonathan Arnett 81670f48fa
Add support for function constants (#37) 2022-08-22 14:53:32 +07:00
Jonathan Arnett 7bfe989c55
Allow empty function bodies (#36) 2022-08-22 14:18:48 +07:00
Jonathan Arnett aed23b28dd
Differentiate data constructor names from type names (#28) 2022-05-24 14:37:32 +07:00
Jonathan Arnett 17ed183fc8
Fix for comment-in-string bug (#27)
Nodes defined in `extras` can be expected before an node. Thus, `comment` could be expected before `escape_sequence` or `quoted_content`; aka inside of a string. Naturally, this makes no sense.

I tried wrapping `escape_sequence` and `quoted_content` in `token.immediate` to resolve the issue, but it had no effect (maybe is specific to whitespace?). Instead, I found success in largely copying [`tree-sitter-rust`'s solution of using an external scanner for string content](9a6d980afb/src/scanner.c (L27-L40)).
2022-05-23 00:17:07 +07:00
Jonathan Arnett b249843e44
Add support for v0.21.0 (aka add bang negation) (#24) 2022-05-04 14:37:31 +07:00
Michael Davis 7159ce9615 Generate parser 2022-03-24 20:12:21 +07:00
Michael Davis a89523b436 Generate parser 2022-03-11 19:16:32 +07:00
Michael Davis 459ff49e91 Generate parser 2022-02-28 02:49:55 +07:00
Jonathan Arnett cfcbca3f8f
Correct name from "type_constructor" to "data_constructor" (#16) 2022-02-26 12:20:54 +07:00
Jonathan Arnett c4743d7776
Extract parts of a string as separate AST nodes (#13) 2022-02-14 11:35:13 +07:00
Michael Davis 3ffbfeb43a
make locals.scm queries more granular (#8)
* make locals.scm queries more granular

* split out (label) nodes from (identifier)

* run formatter

* use (label) for labeled params nodes

* capture all (label)s as properties
2022-01-15 20:13:55 +07:00
Jonathan Arnett b0a23fe88f Extend binaryExpr to guards as well 2022-01-15 16:56:44 +07:00
Michael Davis d68eab58cf
use fields for left,operator,right of binary expressions (#9) 2022-01-15 15:56:34 +07:00
Michael Davis 481ebe0be9
parse implicit discard '..' as '$.list_pattern_tail' (#3) 2022-01-14 01:43:58 +07:00
Jonathan Arnett 01f1c1a361 Rename constructor_pattern to record_pattern 2022-01-06 01:17:38 +07:00
Jonathan Arnett d97c67eab6 Support funky syntax, especially trailing commas 2022-01-04 03:42:10 +07:00
Jonathan Arnett 399ea8eca9 Merged discard_var into discard, var into identifier 2022-01-03 00:26:47 +07:00
Jonathan Arnett d08180396b Refine case structure a tad 2022-01-02 17:00:21 +07:00
Jonathan Arnett e40a645e11 Also parse comments 2022-01-02 16:50:13 +07:00
Jonathan Arnett 12a4daa54c Label function bodies 2022-01-02 15:25:18 +07:00
Jonathan Arnett 35cd8b2dfd A great big update
Highlights:
- Give "_upname" the visible name "type_identifier". Name stolen
shamelessly from tree-sitter-rust.
- Remove "record_name" in favor of "type_identifier".
- Remote "function_name" in favor of "identifier".
- Surface names for several nodes, mostly using "type_identifier".
- Remove "remote_" variants of several nodes. Essentially we needed to
give these nodes "names" anyhow, and having the name encapsulate the
local vs remote information proved wildly efficient.
2022-01-02 03:35:30 +07:00
Jonathan Arnett e5b283e41a Add or re-add encapsulating nodes
In a previous commit, I removed several encapsulating nodes such as
"parameters" or "arguments" where they were not absolutely necessary.
While reviewing tree-sitter-rust, I noticed that they always
incorporated these encapsulating nodes. This likely helps with AST-based
code navigation, and so I introduced or re-introduced them here.
2022-01-02 01:56:30 +07:00
Jonathan Arnett d22ce5f6ae Fix unlabeled constant record argument bug 2022-01-01 20:54:54 +07:00
Jonathan Arnett dbf9063de1 "Finish" parsing
This commit primarily introduces the ability to parse custom types and
type aliases. The tests for these constructs are contained in the
subsequent commit, because they were written against the "cleaned up"
AST.
2022-01-01 19:57:20 +07:00