haskell-suite / haskell-src-exts

Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer
Other
193 stars 94 forks source link

Template Haskell expressions with Unicode mathematical white square brackets: `ParseFailed`. #466

Open kindaro opened 1 year ago

kindaro commented 1 year ago

expected

The following code:

parseExpWithMode defaultParseMode {extensions = EnableExtension TemplateHaskell: EnableExtension UnicodeSyntax: extensions defaultParseMode} "⟦x⟧"

— Works and outputs some syntax tree.

actual

A parse error comes out:

ParseFailed ( SrcLoc "<unknown>.hs" 1 1 ) "Parse error: ⟦"

discussion

it works fine with ASCII

The following:

parseExpWithMode defaultParseMode {extensions = EnableExtension TemplateHaskell: EnableExtension UnicodeSyntax: extensions defaultParseMode} "[|x|]"

— Works and outputs some syntax tree.

the test case is broken

There is a test case tests/examples/brackets.hs that is expected to fail!

For example, this is the contents of the file tests/examples/brackets.hs.prettyprinter.golden:

ParseFailed (SrcLoc "tests/examples/brackets.hs" 17 3) "Parse error: \10631"

I reckon so because of #364. However, this test case checks for two things:

There should ideally be two different test cases for these two features. Is there something that stops us from parsing Unicode Template Haskell expressions?