Repository navigation
Improve parsing of numbers and C-style for loops - #55
Closed
nathansobo wants to merge 6 commits into
Closed
nathansobo wants to merge 6 commits into
nathansobo wants to merge 6 commits into
Conversation
added 4 commits
July 30, 2019 11:52
Previously, numbers were just parsed as words. This improves the accuracy of the grammar, and more importantly, avoids parsing # as the start of a comment when a custom base is specified via BASE#NUMBER.
Previously, `i=0` as the first statement in a C-style for loop was parsed as a word.
Contributor
|
@nathansobo @maxbrunsfeld anything I can do to help this over the finish line? :) |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs atom/language-shellscript#148
I'm doing a couple different changes in a single PR since they would conflict if done independently.
The first is a fix for the linked issue that improves parsing of numeric literals. We previously parsed numbers as words, but this excluded a support for numbers with a custom base, as described here. The tl;dr – You can express a number in the form
BASE#NUMBERif you want to express a base other than decimal, up to base 64. TheNUMBERportion can include letters, numbers,@and_to express various digits.The second fix adjusts C-style for loops to expect a variable assignment as the first statement inside the loop parens.
The linked issue includes another problem with arithmetic expansion and evaluation
$((...))and((...)). I will follow up with some fixes for those in this PR before requesting review.