Module

Text.Parsing.Parser.String.Basic

Package
purescript-parsing
Repository
purescript-contrib/purescript-parsing

Basic String parsers derived from primitive String parsers.

Note: In the future, the noneOf, noneOfCodePoints, oneOf, oneOfCodePoints, skipSpaces, whiteSpace should be moved into this module and removed from the Text.Parsing.Parser.String module, because they are not primitive parsers.

#digit Source

digit :: forall m. Monad m => ParserT String m Char

Parse a digit. Matches any char that satisfies Data.CodePoint.Unicode.isDecDigit.

#hexDigit Source

hexDigit :: forall m. Monad m => ParserT String m Char

Parse a hex digit. Matches any char that satisfies Data.CodePoint.Unicode.isHexDigit.

#octDigit Source

octDigit :: forall m. Monad m => ParserT String m Char

Parse an octal digit. Matches any char that satisfies Data.CodePoint.Unicode.isOctDigit.

#letter Source

letter :: forall m. Monad m => ParserT String m Char

Parse an alphabetical character. Matches any char that satisfies Data.CodePoint.Unicode.isAlpha.

#space Source

space :: forall m. Monad m => ParserT String m Char

Parse a space character. Matches any char that satisfies Data.CodePoint.Unicode.isSpace.

#upper Source

upper :: forall m. Monad m => ParserT String m Char

Parse an uppercase letter. Matches any char that satisfies Data.CodePoint.Unicode.isUpper.

#alphaNum Source

alphaNum :: forall m. Monad m => ParserT String m Char

Parse an alphabetical or numerical character. Matches any char that satisfies Data.CodePoint.Unicode.isAlphaNum.

#intDecimal Source

intDecimal :: forall m. Monad m => ParserT String m Int

Parser based on the Data.Int.fromString function.

This should be the inverse of show :: String -> Int.

Examples of strings which can be parsed by this parser:

  • "3"
  • "-3"
  • "+300"

#number Source

number :: forall m. Monad m => ParserT String m Number

Parser based on the Data.Number.fromString function.

This should be the inverse of show :: String -> Number.

Examples of strings which can be parsed by this parser:

  • "3"
  • "3.0"
  • "0.3"
  • "-0.3"
  • "+0.3"
  • "-3e-1"
  • "-3.0E-1.0"
  • "NaN"
  • "-Infinity"

Re-exports from Text.Parsing.Parser.String

#whiteSpace Source

whiteSpace :: forall m. Monad m => ParserT String m String

Match zero or more whitespace characters satisfying Data.CodePoint.Unicode.isSpace. Always succeeds.

#skipSpaces Source

skipSpaces :: forall m. Monad m => ParserT String m Unit

Skip whitespace characters and throw them away. Always succeeds.

#oneOfCodePoints Source

oneOfCodePoints :: forall m. Monad m => Array CodePoint -> ParserT String m CodePoint

Match one of the Unicode characters in the array.

#oneOf Source

oneOf :: forall m. Monad m => Array Char -> ParserT String m Char

Match one of the BMP Chars in the array.

#noneOfCodePoints Source

noneOfCodePoints :: forall m. Monad m => Array CodePoint -> ParserT String m CodePoint

Match any Unicode character not in the array.

#noneOf Source

noneOf :: forall m. Monad m => Array Char -> ParserT String m Char

Match any BMP Char not in the array.