-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse TH-quoted list constructor: '[]
Teach the parser to parse the empty list constructor ([]) quoted using Template Haskell's data constructor quotation syntax (' prefix) within expressions: '[] This syntax is accepted by at least GHC 8.4.3.
- Loading branch information
1 parent
3f6c154
commit 99876aa
Showing
7 changed files
with
262 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
f = g 'Constructor 'function | ||
h = g '() '[] |
1 change: 1 addition & 0 deletions
1
tests/examples/TemplateHaskellQuotedNames.hs.exactprinter.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Match |
246 changes: 246 additions & 0 deletions
246
tests/examples/TemplateHaskellQuotedNames.hs.parser.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
ParseOk | ||
( Module | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 1 1 4 1 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 1 1 1 1 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 1 2 1 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 1 2 1 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 1 2 1 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 1 3 1 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 4 1 4 1 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 4 1 4 1 | ||
] | ||
} | ||
Nothing | ||
[ LanguagePragma | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 1 1 1 33 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 1 1 1 13 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 1 30 1 33 | ||
] | ||
} | ||
[ Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 1 14 1 29 | ||
, srcInfoPoints = [] | ||
} | ||
"TemplateHaskell" | ||
] | ||
] | ||
[] | ||
[ PatBind | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 1 2 29 | ||
, srcInfoPoints = [] | ||
} | ||
(PVar | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 1 2 2 | ||
, srcInfoPoints = [] | ||
} | ||
(Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 1 2 2 | ||
, srcInfoPoints = [] | ||
} | ||
"f")) | ||
(UnGuardedRhs | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 3 2 29 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 3 2 4 ] | ||
} | ||
(App | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 5 2 29 | ||
, srcInfoPoints = [] | ||
} | ||
(App | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 5 2 19 | ||
, srcInfoPoints = [] | ||
} | ||
(Var | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 5 2 6 | ||
, srcInfoPoints = [] | ||
} | ||
(UnQual | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 5 2 6 | ||
, srcInfoPoints = [] | ||
} | ||
(Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 5 2 6 | ||
, srcInfoPoints = [] | ||
} | ||
"g"))) | ||
(VarQuote | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 7 2 19 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 7 2 8 ] | ||
} | ||
(UnQual | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 8 2 19 | ||
, srcInfoPoints = [] | ||
} | ||
(Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 8 2 19 | ||
, srcInfoPoints = [] | ||
} | ||
"Constructor")))) | ||
(VarQuote | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 20 2 29 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 20 2 21 | ||
] | ||
} | ||
(UnQual | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 21 2 29 | ||
, srcInfoPoints = [] | ||
} | ||
(Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 2 21 2 29 | ||
, srcInfoPoints = [] | ||
} | ||
"function"))))) | ||
Nothing | ||
, PatBind | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 1 3 14 | ||
, srcInfoPoints = [] | ||
} | ||
(PVar | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 1 3 2 | ||
, srcInfoPoints = [] | ||
} | ||
(Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 1 3 2 | ||
, srcInfoPoints = [] | ||
} | ||
"h")) | ||
(UnGuardedRhs | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 3 3 14 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 3 3 4 ] | ||
} | ||
(App | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 5 3 14 | ||
, srcInfoPoints = [] | ||
} | ||
(App | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 5 3 10 | ||
, srcInfoPoints = [] | ||
} | ||
(Var | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 5 3 6 | ||
, srcInfoPoints = [] | ||
} | ||
(UnQual | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 5 3 6 | ||
, srcInfoPoints = [] | ||
} | ||
(Ident | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 5 3 6 | ||
, srcInfoPoints = [] | ||
} | ||
"g"))) | ||
(VarQuote | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 7 3 10 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 7 3 8 ] | ||
} | ||
(Special | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 8 3 10 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 8 3 9 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 9 3 10 | ||
] | ||
} | ||
(UnitCon | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 8 3 10 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 8 3 9 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 9 3 10 | ||
] | ||
})))) | ||
(VarQuote | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 11 3 14 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 11 3 12 | ||
] | ||
} | ||
(Special | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 12 3 14 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 12 3 13 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 13 3 14 | ||
] | ||
} | ||
(ListCon | ||
SrcSpanInfo | ||
{ srcInfoSpan = | ||
SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 12 3 14 | ||
, srcInfoPoints = | ||
[ SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 12 3 13 | ||
, SrcSpan "tests/examples/TemplateHaskellQuotedNames.hs" 3 13 3 14 | ||
] | ||
}))))) | ||
Nothing | ||
] | ||
, [] | ||
) |
1 change: 1 addition & 0 deletions
1
tests/examples/TemplateHaskellQuotedNames.hs.prettyparser.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Match |
3 changes: 3 additions & 0 deletions
3
tests/examples/TemplateHaskellQuotedNames.hs.prettyprinter.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
f = g 'Constructor 'function | ||
h = g '() '[] |