Closed Karang closed 4 years ago
looks good
looks good
* how confident are you this support everything of mojangson ? * let's remove the old one
1) It passes all the tests + the new example that was not supported before. The grammar I wrote was inspired by what was already existing, so if I didn't make any mistake, it should support everything the old grammar supported + quoted objects (and is a bit more permissive with whitespaces) 2) ok
I implemented a new version of the parser, using nearley.js. IMO nearley is a better library than jison (not only it handle left recursion very well, but I also found the grammar easier to specify) The refactoring allowed me to parse the string from issue: https://github.com/PrismarineJS/mineflayer/issues/1167 (added it as a test) For now I added a parse2 method that use the new parser, let me know if I can remove the other implementation or if you want to keep both.
I think the nearley syntax is shorter and simpler to understand, but that is subjective so let me know your opinion. The hope is with a simpler syntax, the library would be easier to maintain.