Compiler.Parse.Pattern

This module provides parsers for Gren patterns.

parser : Parser Context Error Pattern

Use this to parse patterns.

String.Parser.run parser Compiler.Parse.Context.empty source
parserNoAlias : Parser Context Error Pattern

Same as parser, but doesn't look for the as keyword following the pattern

topLevelParser : Parser Context Error Pattern

Use this parser when you know that you're expecting exactly one pattern, as opposed to one or more patterns. As an example: this parser will treat MyCtor one as one pattern, not two.

aliasTopLevelParser : Parser Context Error Pattern

Use this when you want a topLevelParser that accepts aliases with the as keyword.

String.Parser.run parser Compiler.Parse.Context.empty source
type Error
= ExpectedChar Char
| ExpectedKeyword String
| VariableError Error
| NumberError Error
| FloatNotSupported
| StringError Error
| SpaceError Error

The kind of errors that can happen while parsing patterns.

errorToString : Error -> String

Returns a human-readable description of an Error.