Skip to content

Commit

Permalink
[ #344 ] layout: document surprising behavior of Explicit {
Browse files Browse the repository at this point in the history
```
module A where {
  module B where
  module C where
}
```
is surprisingly parsed as
```
module A where {
  module B where {
    module C where {
      }
    }
  }
```
Yet this conforms with Haskell's indentation rules.

Apparently, the start column after { does not matter, so the input
looks to the parser like:
```
module A where {
module B where
  module C where
}
```
  • Loading branch information
andreasabel committed Mar 6, 2021
1 parent 47c8422 commit a1a19c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion testing/regression-tests/194_layout/good02.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module Top where
module B where
module B1 where
module C where
module CA where
module CA where {
module CA1 where
module CA2 where
}
module CB where
module D where {
module DA where {}; module DB where
Expand Down
6 changes: 3 additions & 3 deletions testing/regression-tests/194_layout/good02.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Parse Successful!

[Abstract Syntax]

Modl (Ident "Top") [Modl (Ident "A") [],Modl (Ident "B") [Modl (Ident "B1") []],Modl (Ident "C") [Modl (Ident "CA") [Modl (Ident "CA1") [],Modl (Ident "CA2") []],Modl (Ident "CB") []],Modl (Ident "D") [Modl (Ident "DA") [],Modl (Ident "DB") [Modl (Ident "DB1") [],Modl (Ident "DB2") [Modl (Ident "DB2A") []]],Modl (Ident "DC") []],Modl (Ident "E") [Modl (Ident "EA") [],Modl (Ident "EB") [Modl (Ident "EB1") [],Modl (Ident "EB1") []],Modl (Ident "EC") [Modl (Ident "EC1") [],Modl (Ident "EC2") [Modl (Ident "EC2A") []]]],Modl (Ident "F") []]
Modl (Ident "Top") [Modl (Ident "A") [],Modl (Ident "B") [Modl (Ident "B1") []],Modl (Ident "C") [Modl (Ident "CA") [Modl (Ident "CA1") [Modl (Ident "CA2") []]],Modl (Ident "CB") []],Modl (Ident "D") [Modl (Ident "DA") [],Modl (Ident "DB") [Modl (Ident "DB1") [],Modl (Ident "DB2") [Modl (Ident "DB2A") []]],Modl (Ident "DC") []],Modl (Ident "E") [Modl (Ident "EA") [],Modl (Ident "EB") [Modl (Ident "EB1") [],Modl (Ident "EB1") []],Modl (Ident "EC") [Modl (Ident "EC1") [],Modl (Ident "EC2") [Modl (Ident "EC2A") []]]],Modl (Ident "F") []]

[Linearized tree]

Expand All @@ -18,8 +18,8 @@ module Top where {
module C where {
module CA where {
module CA1 where {
} ;
module CA2 where {
module CA2 where {
}
}
} ;
module CB where {
Expand Down

0 comments on commit a1a19c2

Please sign in to comment.