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

Weird special behavior of layout resolution at beginning of file #412

Open
andreasabel opened this issue Feb 8, 2022 · 0 comments
Open
Labels
discussion Haskell layout Concerning layout (keywords)

Comments

@andreasabel
Copy link
Member

andreasabel commented Feb 8, 2022

Given grammar:

Priv.     Decl ::= "private" "{" [Decl] "}" ;
separator Decl ";" ;
layout "private" ;

The following is accepted but should not, without top-level layout:

private
private

This is parsed as:

Priv [Priv []]

One could argue that this is a case of NondecreasingIndentation, but it is not in line with the following example:

private
  private
  private

This gives, as naturally expected:

Priv [Priv [],Priv []]

Finally, this fails (as naturally expected):

private
  private
  private
private

EDIT: Apparently, this is a feature, not a bug: https://github.com/BNFC/bnfc/blob/19151603ff5b0fd8fab3b1a6892321246362e76c/testing/regression-tests/194_layout/good05.in

@andreasabel andreasabel added bug Haskell layout Concerning layout (keywords) labels Feb 8, 2022
@andreasabel andreasabel added this to the 2.9.4 milestone Feb 8, 2022
@andreasabel andreasabel added discussion and removed bug labels Feb 8, 2022
@andreasabel andreasabel modified the milestones: 2.9.4, 2.9.5 Feb 8, 2022
@andreasabel andreasabel removed this from the 2.9.5 milestone Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Haskell layout Concerning layout (keywords)
Projects
None yet
Development

No branches or pull requests

1 participant