feat(parse): spruce up this package to make it useful#121
Merged
michaelfig merged 10 commits intomainfrom Mar 25, 2025
Merged
Conversation
ef31500 to
1b45c53
Compare
dckc
approved these changes
Mar 10, 2025
| /** | ||
| * Justin parser template tag. | ||
| */ | ||
| export const justin = makeJustin(peg.extends(json)); |
Contributor
There was a problem hiding this comment.
ok... I got this to work in the case of:
justin`make(BLD, BigInt(100))`My first attempt was:
justin`make(BLD, 100n)`The diagnostic was pretty misleading: quasiRest is not a function.
Member
Author
There was a problem hiding this comment.
I fixed this error. Now it returns the diagnostic I was expecting:
justin`make(BLD, 100n)`
-------template--------
"make(BLD, 100n)"
-------
looking for digit, frac, exp, _WSN
Syntax error at 13 "n" #0:13
and I added support for bigint literals, so now you should get:
[
'call',
[ 'use', 'make', _pegPosition: '"m" #0:0' ],
[
[ 'use', 'BLD', _pegPosition: '"B" #0:5' ],
[ 'data', 100n, _pegPosition: '"1" #0:10' ],
_pegPosition: '"(" #0:4'
],
_pegPosition: '"m" #0:0'
]414d43e to
d267a77
Compare
d267a77 to
77855d5
Compare
dckc
approved these changes
Mar 24, 2025
| t.deepEqual(parse(`12345`), ast(0, 'data', 12345)); | ||
| t.deepEqual(parse(`12_345`), ast(0, 'data', 12345)); | ||
| t.deepEqual(parse('9898n'), ast(0, 'data', BigInt(9898))); | ||
| t.deepEqual(parse('98_9_8n'), ast(0, 'data', BigInt(9898))); |
Member
Author
|
@dckc, thanks for the reapproval! Shall I crank out a new release of |
Contributor
|
a release would be nice, thanks. low priority, though |
29 tasks
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.
To reduce the burden of figuring out how to use this package, add some more meaningful exports to main.js.