purescript-0.11.7: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Parser.Common

Description

Useful common functions for building parsers

Synopsis

Documentation

properName :: TokenParser (ProperName a) Source #

Parse a general proper name.

typeName :: TokenParser (ProperName TypeName) Source #

Parse a proper name for a type.

kindName :: TokenParser (ProperName KindName) Source #

Parse a proper name for a kind.

dataConstructorName :: TokenParser (ProperName ConstructorName) Source #

Parse a proper name for a data constructor.

moduleName :: TokenParser ModuleName Source #

Parse a module name

parseQualified :: TokenParser a -> TokenParser (Qualified a) Source #

Parse a qualified name, i.e. M.name or just name

parseIdent :: TokenParser Ident Source #

Parse an identifier.

parseLabel :: TokenParser PSString Source #

Parse a label, which may look like an identifier or a string

parseOperator :: TokenParser (OpName a) Source #

Parse an operator.

augment :: Stream s m t => ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a Source #

Run the first parser, then match the second if possible, applying the specified function on a successful match

fold :: ParsecT s u m a -> ParsecT s u m b -> (a -> b -> a) -> ParsecT s u m a Source #

Run the first parser, then match the second zero or more times, applying the specified function for each match

buildPostfixParser :: Stream s m t => [a -> ParsecT s u m a] -> ParsecT s u m a -> ParsecT s u m a Source #

Build a parser from a smaller parser and a list of parsers for postfix operators

mark :: Parsec s ParseState a -> Parsec s ParseState a Source #

Mark the current indentation level

checkIndentation :: (Column -> Text) -> (Column -> Column -> Bool) -> Parsec s ParseState () Source #

Check that the current identation level matches a predicate

indented :: Parsec s ParseState () Source #

Check that the current indentation level is past the current mark

same :: Parsec s ParseState () Source #

Check that the current indentation level is at the same indentation as the current mark

readComments :: Parsec [PositionedToken] u [Comment] Source #

Read the comments from the the next token, without consuming it

toSourcePos :: SourcePos -> SourcePos Source #

Convert from Parsec sourcepos

withSourceSpan :: (SourceSpan -> [Comment] -> a -> b) -> Parsec [PositionedToken] u a -> Parsec [PositionedToken] u b Source #

Read source position information and comments