node-ebnf icon indicating copy to clipboard operation
node-ebnf copied to clipboard

Replace '\n' with EOL from os module

Open simon-p-r opened this issue 6 years ago • 3 comments

Will you accept a PR for this? Also I cannot view notation of accepted EBNF format that parser will accept, I have tried parsing several simple grammer files but all fail with no real information on what is wrong with them.

simon-p-r avatar Jan 29 '19 09:01 simon-p-r

You can define EOL in your grammar, you can also take a look at the tests for different grammars.

https://github.com/menduz/node-ebnf/blob/194343232fd61da549abf3995d3dabdee0b7670b/test/NewLang.spec.ts#L140

Sadly EBNF or ABNF are not compatible across every implementation out there because there is no strict standard. Every parser adds its own flavors to the grammar.

menduz avatar Jan 29 '19 15:01 menduz

Sorry I was not clear, on this line '\n' is used when os.EOL should be used instead. I am new to grammar files and have discovered there is no common format across libraries. I will open PR to fix if you want.

simon-p-r avatar Jan 29 '19 15:01 simon-p-r

As far as I can see in those files as long as \n is used for error reporting or logs we are good to go!

menduz avatar Jan 29 '19 16:01 menduz