Closed VBeatrice closed 2 years ago
Mmh, I am not sure. This gives a better error message, but still closingToken
will make the layouter crash when it shouldn't, won't it?
What about the round-trip example (parse/print/parse) for the Alfa.cf
grammar?
closingToken
crashes if one tries to resolve the layouts of a file where the layouts have already been resolved a first time. (when the grammar uses the top level layout pragma)
In the round-trip test the layouts are resolved once, before the first parsing.
Now I finally found a small reproducer:
terminator Exp ";" ;
layout toplevel ;
Var. Exp ::= Ident;
Let. Exp ::= "let" "{" [Exp] "}" "in" Exp ;
layout "let" ;
layout stop "in" ;
Input:
let {}
in x
Error is:
TestTest: Layout error at line 2, column 4: trying to close a top level block.
Remaining tokens: x
This seems to be a problem with the implementation of layout stop
.
The
closingToken
function cases in the layout solver were not exhaustive