Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@michaelfig
Copy link
Member

To reduce the burden of figuring out how to use this package, add some more meaningful exports to main.js.

@michaelfig michaelfig requested a review from dckc March 5, 2025 06:22
@michaelfig michaelfig self-assigned this Mar 5, 2025
/**
* Justin parser template tag.
*/
export const justin = makeJustin(peg.extends(json));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

@michaelfig michaelfig Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'
]

@michaelfig michaelfig requested a review from dckc March 13, 2025 05:38
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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯

@michaelfig michaelfig merged commit 800adc7 into main Mar 25, 2025
3 checks passed
@michaelfig michaelfig deleted the mfig-spruce-parse branch March 25, 2025 03:43
@michaelfig
Copy link
Member Author

@dckc, thanks for the reapproval! Shall I crank out a new release of @jessie.js/parse for you, or are you still experimenting?

@dckc
Copy link
Contributor

dckc commented Mar 25, 2025

a release would be nice, thanks.

low priority, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants