DmitrySoshnikov / regexp-tree

Regular expressions processor in JavaScript
MIT License
400 stars 45 forks source link

Support Windows for build script #134

Closed Golmote closed 6 years ago

Golmote commented 6 years ago

npm run build currently throws errors on Windows.

I usually build manually by calling:

node ./node_modules/syntax-cli/bin/syntax -g ./src/parser/regexp.bnf -o ./src/parser/generated/regexp-tree.js -m lalr1 --loc
DmitrySoshnikov commented 6 years ago

Yeah, I had to switch to shelljs for this reason, in Syntax repo: https://github.com/DmitrySoshnikov/syntax/blob/master/scripts/build.js.

Golmote commented 6 years ago

Oh I didn't realize you assigned yourself on this. Well I gave it a try, feel free to discard the PR if you have something else on your mind ;)

DmitrySoshnikov commented 6 years ago

@Golmote, no worries! I started the diff at work where I have Windows machine, but haven't finished it yet. BTW, I wasn't able to run parser generation on Windows due to bug in Syntax which I had to fix first (that's why I postponed this issue).

Specifically, this bug: https://github.com/DmitrySoshnikov/syntax/commit/d7610031b7f725887c3f6a34785fd977d2348f90 the lexer didn't work for me because of using \n for newline, and on Windows it's \r\n. I'm wondering how does it work for you? Do you use Unix-style newlines on Windows?

Anyways, it'd be great to also update syntax-cli dependency to the latest version 0.0.98 which fixes this bug for Windows machines.

Other than that, great job!

Golmote commented 6 years ago

@DmitrySoshnikov Wow, I didn't realize you fixed it in syntax-cli, that's great! I ran into this issue the first time I edited the grammar, indeed. I had to configure my IDE to only use \n when working on regexp-tree.

DmitrySoshnikov commented 6 years ago

Yeah, the issue with \r\n was a generic issue of the Syntax tool anyways.