Skip to content
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

Calculator example: fixing some weird behavior about whitespaces #580

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

crguezl
Copy link

@crguezl crguezl commented Jun 4, 2021

Hi,

Thanks for giving us Nearley.js. It is a great tool and I have used successfully in the classroom this course.

This pull request is about the arithmetic.ne grammar example in examples/calculator. When you run it, it has a peculiar behavior for some inputs like:

 ➜  calculator git:(master) . ./build-and-test.sh 
> sinpi
1.2246467991473532e-16
> sqrtsinpi
1.1066376096750703e-8

that is due to the set of rules for N and P and _

With the proposed change, this is the new behavior:

calculator git:(master) ✗ . ./build-and-test.sh
> sinpi
-----^  Error.
> sin(pi)
1.2246467991473532e-16
> sqrtsinpi
------^  Error.
> sqrt(sin(pi))
1.1066376096750703e-8
> 

Nothing else changes

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.

2 participants