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

Parse single-quoted GHC output more reliably #301

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

9999years
Copy link
Member

@9999years 9999years commented Jun 21, 2024

GHC output contains quoted fragments:

Module graph contains a cycle:
        module ‘C’ (./C.hs)
        imports module ‘A’ (A.hs)
  which imports module ‘B’ (./B.hs)
  which imports module ‘C’ (./C.hs)

When Unicode output is not available, the Unicode quotes are substituted for GNU-style ASCII quotes:

module `C' (./C.hs)

However, when the quoted text starts or ends with a single quote, ASCII quotes are omitted. This leads to ambiguous output:

A   → `A'
A'  → A'
`A' → `A'
'A  → 'A
'A' → 'A'

Correctly parsing this is challenging.

This probably increases the amount of backtracking and lookahead required for these parsers. Not sure if that's significant or how concerning it is...

Split off of #297

Copy link

linear bot commented Jun 21, 2024

@github-actions github-actions bot added the patch Bug fixes or non-functional changes label Jun 21, 2024
@9999years 9999years force-pushed the wiggles/dux-2348-fix-single-quoted-ghc-output-parser branch from 5398873 to c3d456c Compare June 21, 2024 21:02
@9999years 9999years mentioned this pull request Jun 21, 2024
3 tasks
GHC output contains quoted fragments:

    Module graph contains a cycle:
            module ‘C’ (./C.hs)
            imports module ‘A’ (A.hs)
      which imports module ‘B’ (./B.hs)
      which imports module ‘C’ (./C.hs)

When Unicode output is not available, the Unicode quotes are substituted
for GNU-style ASCII quotes:

    module `C' (./C.hs)

However, when the quoted text starts or ends with a single quote, ASCII
quotes are omitted. This leads to ambiguous output:

    A   → `A'
    A'  → A'
    `A' → `A'
    'A  → 'A
    'A' → 'A'

Correctly parsing this is challenging.

This probably increases the amount of backtracking and lookahead
required for these parsers. Not sure if that's significant or relevant.
@9999years 9999years force-pushed the wiggles/dux-2348-fix-single-quoted-ghc-output-parser branch from c3d456c to 24fd4a1 Compare June 21, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Bug fixes or non-functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant