ianlewis / lexparse

Experimental lexer/parser library written in Go
Apache License 2.0
0 stars 1 forks source link

feat: Add binary tree functions. #60

Closed ianlewis closed 2 months ago

ianlewis commented 2 months ago

Adds binary tree utility functions for dealing with binary syntax trees.

Fixes #51

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.68%. Comparing base (5233de2) to head (9386407).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/ianlewis/lexparse/pull/60/graphs/tree.svg?width=650&height=150&src=pr&token=PD7UEVGU5S&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ian+Lewis)](https://app.codecov.io/gh/ianlewis/lexparse/pull/60?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ian+Lewis) ```diff @@ Coverage Diff @@ ## main #60 +/- ## ========================================== + Coverage 88.46% 90.68% +2.22% ========================================== Files 3 3 Lines 338 365 +27 ========================================== + Hits 299 331 +32 + Misses 25 22 -3 + Partials 14 12 -2 ``` | [Files with missing lines](https://app.codecov.io/gh/ianlewis/lexparse/pull/60?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ian+Lewis) | Coverage Δ | | |---|---|---| | [parser.go](https://app.codecov.io/gh/ianlewis/lexparse/pull/60?src=pr&el=tree&filepath=parser.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ian+Lewis#diff-cGFyc2VyLmdv) | `93.46% <100.00%> (+3.78%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/ianlewis/lexparse/pull/60/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ian+Lewis)
ianlewis commented 2 months ago

@superfrink I implemented some binary tree functions including rotations. This should hopefully make some use cases for parsing simpler, like the infix calculator.

superfrink commented 2 months ago

This error is not used anymore

var ErrMissingRequiredNode = errors.New("missing required node")
superfrink commented 2 months ago

Small increase in test coverage in https://github.com/superfrink/lexparse/commit/5e3df2ca20804296575043b6d127781abee38d90

ianlewis commented 2 months ago

This error is not used anymore

var ErrMissingRequiredNode = errors.New("missing required node")

Removed.

ianlewis commented 2 months ago

Small increase in test coverage in superfrink@5e3df2c

I merged this in. Small change is that I renamed the functions to TestNode_... since they are methods on the Node struct.