Skip to content

Commit

Permalink
fix: binary expressions to allow nesting
Browse files Browse the repository at this point in the history
Fixes #41
  • Loading branch information
dlvandenberg committed Aug 28, 2024
1 parent c2d1f6d commit dd7874a
Show file tree
Hide file tree
Showing 12 changed files with 10,056 additions and 7,695 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-angular"
description = "Angular grammar for tree-sitter"
version = "0.4.2"
version = "0.4.3"
keywords = ["incremental", "parsing", "angular"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-angular"
Expand Down
13 changes: 8 additions & 5 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,13 @@ module.exports = grammar(HTML, {

// Binary expression
binary_expression: ($) =>
seq(
field('left', $._primitive),
field('operator', $._binary_op),
field('right', $._primitive),
prec.left(
PREC.CALL,
seq(
field('left', $.expression),
field('operator', $._binary_op),
field('right', choice($.binary_expression, $.expression)),
),
),

// Ternary expression
Expand Down Expand Up @@ -470,7 +473,7 @@ module.exports = grammar(HTML, {
seq(
field('key', choice($.identifier, $.string)),
':',
field('value', choice($.expression, $.unary_expression)),
field('value', $._any_expression),
optional(','),
),

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tree-sitter-angular",
"version": "0.4.2",
"version": "0.4.3",
"description": "Tree-sitter grammar for the Angular framework",
"main": "bindings/node",
"types": "bindings/node",
Expand Down
78 changes: 41 additions & 37 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 19 additions & 63 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dd7874a

Please sign in to comment.