Compiler.Parse.Declaration
This module provides parsers for Gren declarations (values, types, etc.).
type alias Declaration =
{ docs : Maybe (Located String), value : DeclarationValue }
A Declaration is a top-level definition in a module. Like type- or
function definitions. Each declaration can have a documentation comment.
type DeclarationValue
= Alias Alias
| Union Union
| Value Value
| Port Port
The actual declaration, without documentation comment.
parser :
Parser Context Error Declaration
Use this to parse declarations.
String.Parser.run parser Compiler.Parse.Context.empty source
docParser :
(String -> err)
-> Parser Context err (Maybe ( Located String))
Use this to parse documentation comments.
String.Parser.run (docParser ExpectedKeyword) Compiler.Parse.Context.empty source
type Error
= ExpectedKeyword String
| ExpectedChar Char
| VariableError Error
| TypeError Error
| ExprError Error
| SpaceError Error
| IndentationError
The kind of errors that can happen while parsing declarations.
errorToString :
Error -> String
Returns a human-readable description of an Error.