4 ms·
Good point. I added a new branch where I broke the "literal" rule into multiple rules and added some comments where I try to explain what's going on in English.
by sebcat 10y ago
Good point. I added a new branch where I broke the "literal" rule into multiple rules and added some comments where I try to explain what's going on in English. I also added an achor to it in the master README.md.
I find it a bit hard to accurately describe the operations with words though, if there's any ambiguities in the wording, let me know!
https://github.com/sebcat/move-literals/blob/commented_expressions/move-literals.lua#L17 https://github.com/sebcat/move-literals/blob/commented_expre...
- akavel 10y agoAwesome, thanks! It's the first time I've seen example PEGs explained so nicely. I've let myself add a few small comments with some additional suggestions. Some additional comments I didn't know how to add on github: - in load_data(), you should most probably use `local` on l.99 and 103; - in load_data() l.99, you could consider using the idiom: local f = assert(io.open(file, "rb")) though arguably it's clearer as it is now. Other than that, it would be even cooler if you could also add some examples in the repo of how to deal with parsing errors, as you showed in another comment!
- sebcat 10y agoThank you for the feedback. The commented_expressions branch looks a lot better than master now, I'll probably merge it. I added the code from the comment to README.md.