-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated parser #85
Updated parser #85
Conversation
8b2de3e
to
bfac747
Compare
Codecov Report
@@ Coverage Diff @@
## develop hirosystems/clarity-repl#85 +/- ##
===========================================
+ Coverage 49.01% 53.95% +4.94%
===========================================
Files 90 96 +6
Lines 24194 28751 +4557
===========================================
+ Hits 11858 15514 +3656
- Misses 12336 13237 +901
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
6b9a34e
to
c38d6b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This improvements are super exciting, and the implementation is really elegant, thank you @obycode!
I added a few feedbacks, curious to get your thoughts!
e6c9a96
to
f20e58c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @obycode!
This parser should have better performance and generate better errors. Resolves: #74
Some diagnostics do not have a proper column number set, leaving it as a 0. The code here subtracts one from the value to translate it to the number of spaces to insert, but if it is 0, this will cause a panic, `attempt to subtract with overflow`.
Comments are still not properly handled yet, but at least they are being properly skipped like whitespace for now.
If there was a comment with no content before a newline, then the next line was being sucked into the comment.
When there is a newline at the end of a file, and an error is reported at the very end (for example, for a missing ')'), this would crash when attempting to print out the line. This is fixed by only advancing the line number when the next token is not the end of the file.
This will be useful during the transition period as we switch from the old parser to the new parser.
While v2 is new, run both parsers and check that the ASTs are equivalent. If not, report a warning and revert to v1.
To match the current implementation in the blockchain, identifiers should be allowed to have special characters like `*`, `/`, `<`, etc. in them, although, a future specification of the Clarity language may make those illegal. Now, the parser will report a warning for those cases. This change required some modified handling of the trait identifiers (ex. `<my-trait>`), so the changes are more significant than might be expected.
The only change in that last push was just rebasing on the latest develop branch (I guess that wasn't the right way to do it). Can you approve again? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I am still doing some testing, but it is in good enough shape to start a review.