Closed jskolovos closed 4 years ago
Ok. After some tests, I have these findings.
It is a bug inside nearley-test.js, expecifically with commander.js
I put console.log('INP=', opts.input) before the instruction parser.feed(opts.input) in the sourcce code of nearley-test.js and when I test with nearley-test ./gg1.js --input '-1' it prints:
When I test with nearley-test ./gg1.js --input '+1' it prints:
Huh, that is odd. It seems the option parser thinks -1 is a flag.
To solve your immediate problem, can you pipe the input you want into nearley-test's stdin instead?
@kach Thanks for your reply.
I was worried that the problem where in the parser, but being in the tester, I can avoid making tests beginning with minus (they are only tests).
And when I put the parser in a program, I know it works just fine.
I think it is important to at least mention it in the docs, In order to help the people new into nearley.js.
Thanks again for the parser, the docs and examples.
I reopened this issue wondering somebody have something to add. Sorry for closing it before
That's alright, I think it can be closed.
Hi, I have problems with a very simple grammar
I compiled it with
and I tested it with nearley-test , I think the following output is incorrect
But with "+" sign instead of "-" it behaves as expected
The nearley version I am using is:
I expected Parse results to be [ [ [ '-' ], [ [ '1' ] ] ] ] with the minus sign.
Is this a bug?? or am I missing something.
Thanks in advance.