diff --git a/lib/purescript-cst/src/Language/PureScript/CST/Errors.hs b/lib/purescript-cst/src/Language/PureScript/CST/Errors.hs index 18ed7079ee..391d42255d 100644 --- a/lib/purescript-cst/src/Language/PureScript/CST/Errors.hs +++ b/lib/purescript-cst/src/Language/PureScript/CST/Errors.hs @@ -53,6 +53,7 @@ data ParserErrorType | ErrQualifiedName | ErrEmptyDo | ErrLexeme (Maybe String) [String] + | ErrQualifierLexeme Char | ErrEof | ErrCustom String deriving (Show, Eq, Ord) @@ -128,6 +129,10 @@ prettyPrintErrorMessage (ParserErrorInfo {..}) = case errType of "Illegal whitespace character " <> displayCodePoint hd ErrLexeme (Just a) _ -> "Unexpected " <> a + ErrQualifierLexeme hd | isSpace hd -> + "Unexpected whitespace character " <> displayCodePoint hd <> ", expected qualifier" + ErrQualifierLexeme a -> + "Unexpected " <> [ a ] <> ", expected qualifier" ErrLineFeedInString -> "Unexpected line feed in string literal" ErrAstralCodePointInChar -> diff --git a/lib/purescript-cst/src/Language/PureScript/CST/Lexer.hs b/lib/purescript-cst/src/Language/PureScript/CST/Lexer.hs index 2ad7646479..a0e7ac0600 100644 --- a/lib/purescript-cst/src/Language/PureScript/CST/Lexer.hs +++ b/lib/purescript-cst/src/Language/PureScript/CST/Lexer.hs @@ -357,7 +357,7 @@ token = peek >>= maybe (pure TokEof) k0 | Char.isUpper ch2 -> next *> upper qual' ch2 | isIdentStart ch2 -> next *> lower qual' ch2 | isSymbolChar ch2 -> next *> operator qual' [ch2] - | otherwise -> throw $ ErrLexeme (Just [ch2]) [] + | otherwise -> throw $ ErrQualifierLexeme ch2 Nothing -> throw ErrEof _ ->