Global Variables

The following global variables are available globally.

  • A Parser that succeeds upon consuming a letter from the English alphabet.

    Declaration

    Swift

    public let letter: Parser<Character, Character> = within("A"..."z").withError("letter")
  • A Parser that succeeds upon consuming an Arabic numeral.

    Declaration

    Swift

    public let digit: Parser<Character, Character> = within("0"..."9").withError("digit")
  • Constructs a Parser that succeeds upon consuming a space character.

    Declaration

    Swift

    public let space: Parser<Character, Character> = token(" ").withError("space")
  • Constructs a Parser that skips zero or more space characters.

    Declaration

    Swift

    public let spaces: Parser<Character, ()> = many(space).discard()
  • Constructs a Parser that succeeds upon consuming a new line character.

    Declaration

    Swift

    public let newLine: Parser<Character, Character> = token("\n").withError("newline")
  • tab

    Constructs a Parser that succeeds upon consuming a tab character.

    Declaration

    Swift

    public let tab: Parser<Character, Character> = token("\t").withError("tab")
  • Constructs a Parser that skips zero or more space characters.

    Declaration

    Swift

    public let whitespace: Parser<Character, ()> = many(space ?? newLine ?? tab).discard().withError("whitespace")
  • Constructs a Parser that succeeds upon consuming an uppercase letter.

    Declaration

    Swift

    public let uppercaseLetter: Parser<Character, Character> = within("A"..."Z").withError("uppercaseLetter")
  • Constructs a Parser that succeeds upon consuming an lowercase letter.

    Declaration

    Swift

    public let lowercaseLetter: Parser<Character, Character> = within("a"..."z").withError("lowercaseLetter")