Improve parsing of numbers and C-style for loops #55
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#NUMBER
if you want to express a base other than decimal, up to base 64. TheNUMBER
portion 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.