ocamllex: Check for matched parentheses in actions#11716
ocamllex: Check for matched parentheses in actions#11716damiendoligez merged 1 commit intoocaml:trunkfrom
Conversation
ccf4470 to
b8b0599
Compare
|
Thanks for this!
How about using a (reference on a) mere list to implement the stack? It
feels to me it would make the code slightly simpler. What do you think?
Is it worth adding a test that verifies that incorrectly formed lexers
are detected?
|
|
+1 for a stack represented as a list. You don't even need a reference: the stack can be passed as argument to the |
b8b0599 to
13273a8
Compare
Nice trick! I mostly write C and Rust nowadays, and had already implemented this for ocamlyacc, so I went with the imperative approach I was familiar with. I switched to the approach you suggested, which required refactoring other code to use a functional style as well. |
damiendoligez
left a comment
There was a problem hiding this comment.
Looks fine. I left a couple of suggestions that you're free to follow or ignore, my approval stands either way.
|
@DemiMarie could you please rebase? |
13273a8 to
572fd80
Compare
|
@damiendoligez done |
|
OK given the fact that the suggestions were minor I'm taking the
responsibility of merging this. Suggestions can always be taken into
acocunt later.
|
|
Sorry, no. This branch now has conflicts with trunk so a rebase is
required.
Gentle ping to @DemiMarie to do so and perhaps you could take this
opportunity to take into account @damiendoligez's suggestions?
|
I can do so but not immediately due to time constraints. |
|
@DemiMarie We can merge this whenever you have the time to fix the trivial conflict in Changes. |
This checks that parentheses and curly braces are properly balenced in ocamllex actions. It also significantly refactors ocamllex’s lexer to pass state using function arguments instead of mutable global variables. Fixes ocaml#7455 for ocamllex (it was already fixed for ocamlyacc).
572fd80 to
761a1a9
Compare
Done. |
|
Merged at last! Many thanks for your work and your patience. |
This checks that parentheses and curly braces are properly balenced in ocamllex actions.
Fixes #7455 for ocamllex (it was already fixed for ocamlyacc).