Skip to content

Commit b38aa73

Browse files
michalmuskalameta-codesync[bot]
authored andcommitted
Add :> (unchecked cast) operator to tree-sitter grammar
Summary: The eqwalizer unchecked cast macro expands to (Expr :> Type), but tree-sitter did not recognize :> as a valid token, causing parse errors. This extends ann_var to accept choice('::', ':>') so both checked and unchecked casts parse correctly. Reviewed By: alanz Differential Revision: D100770553 fbshipit-source-id: a14f816f75128377a34c7f0b8df101e17d78a75e
1 parent c60f720 commit b38aa73

6 files changed

Lines changed: 21947 additions & 21900 deletions

File tree

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ module.exports = grammar({
538538

539539
ann_type: $ => prec(PREC.DCOLON, seq(field("var", $.ann_var), field("ty", $._expr))),
540540

541-
ann_var: $ => prec(PREC.DCOLON, seq(field("var", $.var), '::')),
541+
ann_var: $ => prec(PREC.DCOLON, seq(field("var", $.var), choice('::', ':>'))),
542542

543543
// Both union type and list tail
544544
pipe: $ => prec.right(PREC.PIPE, seq(field("lhs", $._expr), '|', field("rhs", $._expr))),

queries/highlights.scm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
"<-"
190190
"#"
191191
"::"
192+
":>"
192193
"|"
193194
":"
194195
"="

src/grammar.json

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)