Compare commits
No commits in common. "9bc2dfc6f4784ae9de67c87799013510c8bbd572" and "662426cd857e57c9c618059542305e8c86b4d30f" have entirely different histories.
9bc2dfc6f4
...
662426cd85
|
@ -20,7 +20,7 @@ include = [
|
||||||
path = "bindings/rust/lib.rs"
|
path = "bindings/rust/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tree-sitter = ">= 0.19, < 0.21"
|
tree-sitter = "0.20"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|
42
grammar.js
42
grammar.js
|
@ -159,6 +159,16 @@ module.exports = grammar({
|
||||||
// * stab arguments item in `arg1, left when right ->`
|
// * stab arguments item in `arg1, left when right ->`
|
||||||
[$.binary_operator, $._stab_clause_arguments_without_parentheses],
|
[$.binary_operator, $._stab_clause_arguments_without_parentheses],
|
||||||
|
|
||||||
|
// Given `( -> • \n`, the newline could be either:
|
||||||
|
// * stab clause without a body
|
||||||
|
// * stab clause with a body
|
||||||
|
[$._stab_clause_without_body, $._stab_clause_with_body],
|
||||||
|
|
||||||
|
// Given `( -> • /`, `/` token could be either:
|
||||||
|
// * stab clause with a body
|
||||||
|
// * -> as an operator followed by `/`
|
||||||
|
[$._stab_clause_with_body, $.operator_identifier],
|
||||||
|
|
||||||
// Given `((arg1, arg2 • ,`, `arg3` expression can be either:
|
// Given `((arg1, arg2 • ,`, `arg3` expression can be either:
|
||||||
// * stab parenthesised arguments item in `((arg1, arg2, arg3) ->)`
|
// * stab parenthesised arguments item in `((arg1, arg2, arg3) ->)`
|
||||||
// * stab non-parenthesised arguments item in `((arg1, arg2, arg3 ->))`
|
// * stab non-parenthesised arguments item in `((arg1, arg2, arg3 ->))`
|
||||||
|
@ -729,13 +739,20 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
stab_clause: ($) =>
|
stab_clause: ($) =>
|
||||||
// Right precedence, because we want to consume body if any
|
choice($._stab_clause_with_body, $._stab_clause_without_body),
|
||||||
prec.right(
|
|
||||||
seq(
|
_stab_clause_with_body: ($) =>
|
||||||
optional(field("left", $._stab_clause_left)),
|
seq(
|
||||||
field("operator", "->"),
|
optional(field("left", $._stab_clause_left)),
|
||||||
optional(field("right", $.body))
|
field("operator", "->"),
|
||||||
)
|
field("right", $.body)
|
||||||
|
),
|
||||||
|
|
||||||
|
_stab_clause_without_body: ($) =>
|
||||||
|
seq(
|
||||||
|
optional(field("left", $._stab_clause_left)),
|
||||||
|
field("operator", "->"),
|
||||||
|
optional($._terminator)
|
||||||
),
|
),
|
||||||
|
|
||||||
_stab_clause_left: ($) =>
|
_stab_clause_left: ($) =>
|
||||||
|
@ -817,13 +834,10 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
body: ($) =>
|
body: ($) =>
|
||||||
choice(
|
seq(
|
||||||
$._terminator,
|
optional($._terminator),
|
||||||
seq(
|
sep1($._expression, $._terminator),
|
||||||
optional($._terminator),
|
optional($._terminator)
|
||||||
sep1($._expression, $._terminator),
|
|
||||||
optional($._terminator)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|
|
||||||
anonymous_function: ($) =>
|
anonymous_function: ($) =>
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
; Phoenix HTML template
|
|
||||||
((sigil
|
|
||||||
(sigil_name) @_sigil_name
|
|
||||||
(quoted_content) @injection.content)
|
|
||||||
(#eq @_sigil_name "H")
|
|
||||||
(#set! injection.language "heex")
|
|
||||||
(#set! injection.combined))
|
|
|
@ -6452,63 +6452,54 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
"type": "CHOICE",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "CHOICE",
|
||||||
"name": "_terminator"
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_terminator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "SYMBOL",
|
||||||
"members": [
|
"name": "_expression"
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_terminator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "BLANK"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SEQ",
|
"type": "REPEAT",
|
||||||
"members": [
|
"content": {
|
||||||
{
|
"type": "SEQ",
|
||||||
"type": "SYMBOL",
|
"members": [
|
||||||
"name": "_expression"
|
{
|
||||||
},
|
"type": "SYMBOL",
|
||||||
{
|
"name": "_terminator"
|
||||||
"type": "REPEAT",
|
},
|
||||||
"content": {
|
{
|
||||||
"type": "SEQ",
|
"type": "SYMBOL",
|
||||||
"members": [
|
"name": "_expression"
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_terminator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_expression"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_terminator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "BLANK"
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "_terminator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "BLANK"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1082,7 +1082,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "access_call",
|
"type": "access_call",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -684,11 +684,12 @@ end
|
||||||
(integer))))))
|
(integer))))))
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
stab clause / edge cases / empty right-hand-side
|
stab clause / edge cases / empty right-hand-sides
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
fun do
|
fun do
|
||||||
x ->
|
x ->
|
||||||
|
y ->
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -699,8 +700,10 @@ end
|
||||||
(do_block
|
(do_block
|
||||||
(stab_clause
|
(stab_clause
|
||||||
(arguments
|
(arguments
|
||||||
(identifier))
|
(identifier)))
|
||||||
(body)))))
|
(stab_clause
|
||||||
|
(arguments
|
||||||
|
(identifier))))))
|
||||||
|
|
||||||
=====================================
|
=====================================
|
||||||
pattern matching
|
pattern matching
|
||||||
|
|
Loading…
Reference in New Issue