StringParser
- Package
- purescript-string-parsers
- Repository
- purescript-contrib/purescript-string-parsers
Re-exports from StringParser.CodePoints
#whiteSpace Source
whiteSpace :: Parser String
Match many whitespace characters.
#upperCaseChar Source
upperCaseChar :: Parser Char
Match any upper case character.
#skipSpaces Source
skipSpaces :: Parser Unit
Skip many whitespace characters.
#satisfyCodePoint Source
satisfyCodePoint :: (CodePoint -> Boolean) -> Parser CodePoint
Match a code point satisfying the given predicate.
#lowerCaseChar Source
lowerCaseChar :: Parser Char
Match any lower case character.
#anyCodePoint Source
anyCodePoint :: Parser CodePoint
Match any code point.
Re-exports from StringParser.Combinators
#sepEndBy1 Source
sepEndBy1 :: forall a sep. Parser a -> Parser sep -> Parser (NonEmptyList a)
Parse one or more separated values, optionally ending with a separator.
#sepBy1 Source
sepBy1 :: forall a sep. Parser a -> Parser sep -> Parser (NonEmptyList a)
Parse one or more separated values.
#optionMaybe Source
optionMaybe :: forall a. Parser a -> Parser (Maybe a)
Attempt to parse a value, pureing Nothing
in case of failure.
#many1Till Source
many1Till :: forall a end. Parser a -> Parser end -> Parser (NonEmptyList a)
Match a parser until a terminator parser matches, requiring at least one match. Fails when the parser does not consume anymore.
#many1 Source
many1 :: forall a. Parser a -> Parser (NonEmptyList a)
Match a parser one or more times. Stops matching when the parser fails or does not consume anymore.
#endBy1 Source
endBy1 :: forall a sep. Parser a -> Parser sep -> Parser (NonEmptyList a)
Parse one or more separated values, ending with a separator.
#assertConsume Source
assertConsume :: forall a. Parser a -> Parser a
Run given parser and fail if the parser did not consume any input.
#(<?>) Source
Operator alias for StringParser.Combinators.withError (left-associative / precedence 4)
Re-exports from StringParser.Parser
#Parser Source
newtype Parser a
A parser is represented as a function that, when successful, returns
a result and the position where the parse finished or, when it fails,
a ParserError with more information on where and why it failed.
See also printParserError
.
Constructors
Parser (PosString -> Either ParseError { result :: a, suffix :: PosString })
Instances
#ParseError Source
type ParseError = { error :: String, pos :: Pos }
The type of parsing errors.
#runParser Source
runParser :: forall a. Parser a -> String -> Either ParseError a
Run a parser for an input string. See also printParserError
and unParser
for more flexible usages.
#printParserError Source
printParserError :: ParseError -> String
Prints a ParseError's the error message and the position of the error.