Skip to content

Commit

Permalink
Merge pull request #5187 from sellout/doc-lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
aryairani authored Aug 3, 2024
2 parents 97c9109 + 1ee188d commit c049c65
Show file tree
Hide file tree
Showing 20 changed files with 2,190 additions and 1,682 deletions.
12 changes: 10 additions & 2 deletions parser-typechecker/src/Unison/PrintError.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import Unison.Result qualified as Result
import Unison.Settings qualified as Settings
import Unison.Symbol (Symbol)
import Unison.Syntax.HashQualified qualified as HQ (toText)
import Unison.Syntax.Lexer qualified as L
import Unison.Syntax.Lexer.Unison qualified as L
import Unison.Syntax.Name qualified as Name (toText)
import Unison.Syntax.NamePrinter (prettyHashQualified0)
import Unison.Syntax.Parser (Annotated, ann)
Expand Down Expand Up @@ -1336,7 +1336,7 @@ prettyParseError s e =
lexerOutput :: Pretty (AnnotatedText a)
lexerOutput =
if showLexerOutput
then "\nLexer output:\n" <> fromString (L.debugLex' s)
then "\nLexer output:\n" <> fromString (L.debugPreParse' s)
else mempty

renderParseErrors ::
Expand Down Expand Up @@ -1861,6 +1861,14 @@ renderParseErrors s = \case
<> structuralVsUniqueDocsLink
]
in (msg, rangeForToken <$> [void keyword, void name])
go (Parser.TypeNotAllowed tok) =
let msg =
Pr.lines
[ Pr.wrap "I expected to see a term here, but instead it’s a type:",
"",
tokenAsErrorSite s $ HQ.toText <$> tok
]
in (msg, [rangeForToken tok])

unknownConstructor ::
String -> L.Token (HashQualified Name) -> Pretty ColorText
Expand Down
Loading

0 comments on commit c049c65

Please sign in to comment.