Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make closingToken function pattern matching exhaustive #399

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

VBeatrice
Copy link
Member

The closingToken function cases in the layout solver were not exhaustive

@andreasabel andreasabel added Haskell layout Concerning layout (keywords) labels Nov 1, 2021
@andreasabel andreasabel added this to the 2.9.4 milestone Nov 1, 2021
@andreasabel
Copy link
Member

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?

@VBeatrice
Copy link
Member Author

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.

@andreasabel andreasabel merged commit 1915160 into BNFC:master Feb 8, 2022
@andreasabel
Copy link
Member
andreasabel commented Feb 8, 2022

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.

andreasabel added a commit that referenced this pull request Feb 8, 2022
andreasabel added a commit that referenced this pull request Feb 8, 2022
Layout stop words will now do not have any special effect when in the
top layout block (column 1).

Fixes a problem where they triggered an exception.
andreasabel added a commit that referenced this pull request Feb 10, 2022
andreasabel added a commit to hangingman/bnfc that referenced this pull request Mar 3, 2022
andreasabel added a commit to hangingman/bnfc that referenced this pull request Mar 3, 2022
Layout stop words will now do not have any special effect when in the
top layout block (column 1).

Fixes a problem where they triggered an exception.
andreasabel added a commit to hangingman/bnfc that referenced this pull request Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Haskell layout Concerning layout (keywords)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants