Skip to content

Broken character literal highlighting #132

Open
@nhatanh002

Description

@nhatanh002

When a character literal contains a "region" start pattern ('(','[','{','"'), everything after the start pattern is interpreted as a contained region, and consequently breaks syntax highlighting. After further investigation, the regex used to match character literal is actually incorrect according to the Haskell 2010 language specification (https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6), which means most valid character literals aren't highlighted at all, and the \u<code> pattern while not being a legal character in Haskell, is correctly highlighted.

For example, '[' here breaks everything after it: ) is not highlighted as a delimiter - like its matching (, and showVol is not highlighted as it should've been, like getVol above:
2021-11-20T01:31:47,889252436+07:00

With the addition of a ' and a ], they "close" the bogus "open" token [ and ', and everything is highlighted correctly again:
2021-11-20T01:33:18,134189766+07:00

The character literal highlighting is not even correct!
2021-11-20T01:47:43,282991015+07:00

This is how the plugin defines the way haskellCharacter should've been highlighted, notice that the "characters" inside of the single quotes are highlighted as if they weren't character literals instead, e.g. A is highlighted as a type, 9 as a number, + as an operator, z as normal text:
2021-11-20T01:49:22,307889855+07:00

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions