Beispiel #1
0
 /**
  * Returns a parser that produces a space character.
  *
  * @param missing The error if there is no character on the stream to produce a space character
  *     with.
  * @param sat The error if the produced character is not a space character.
  * @return A parser that produces a space character.
  * @see Character#isSpace(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> space(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isSpaceChar(c));
 }
Beispiel #2
0
 /**
  * Returns a parser that produces a title-case character.
  *
  * @param missing The error if there is no character on the stream to produce a title-case
  *     character with.
  * @param sat The error if the produced character is not a title-case character.
  * @return A parser that produces a title-case character.
  * @see Character#isTitleCase(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> titleCase(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isTitleCase(c));
 }
Beispiel #3
0
 /**
  * Returns a parser that produces an alpha-numeric character.
  *
  * @param missing The error if there is no character on the stream to produce an alpha-numeric
  *     character with.
  * @param sat The error if the produced character is not an alpha-numeric character.
  * @return A parser that produces an alpha-numeric character.
  * @see Character#isLetterOrDigit(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> alphaNum(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isLetterOrDigit(c));
 }
Beispiel #4
0
 /**
  * Returns a parser that produces a low-surrogate character.
  *
  * @param missing The error if there is no character on the stream to produce a low-surrogate
  *     character with.
  * @param sat The error if the produced character is not a low-surrogate character.
  * @return A parser that produces a low-surrogate character.
  * @see Character#isLowSurrogate(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> lowSurrogate(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isLowSurrogate(c));
 }
Beispiel #5
0
 /**
  * Returns a parser that produces a Java identifier start character.
  *
  * @param missing The error if there is no character on the stream to produce a Java identifier
  *     start character with.
  * @param sat The error if the produced character is not a Java identifier start character.
  * @return A parser that produces a Java identifier start character.
  * @see Character#isJavaIdentifierStart(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> javaIdentifierStart(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isJavaIdentifierStart(c));
 }
Beispiel #6
0
 /**
  * Returns a parser that produces an ISO control character.
  *
  * @param missing The error if there is no character on the stream to produce an ISO control
  *     character with.
  * @param sat The error if the produced character is not an ISO control character.
  * @return A parser that produces an ISO control character.
  * @see Character#isISOControl(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> isoControl(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isISOControl(c));
 }
Beispiel #7
0
 /**
  * Returns a parser that produces an identifier-ignorable character.
  *
  * @param missing The error if there is no character on the stream to produce an
  *     identifier-ignorable character with.
  * @param sat The error if the produced character is not an identifier-ignorable character.
  * @return A parser that produces an identifier-ignorable character.
  * @see Character#isIdentifierIgnorable(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> identifierIgnorable(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isIdentifierIgnorable(c));
 }
Beispiel #8
0
 /**
  * Returns a parser that produces a digit (0 to 9).
  *
  * @param missing The error if there is no character on the stream to produce a digit with.
  * @param sat The error if the produced character is not a digit.
  * @return A parser that produces a digit (0 to 9).
  */
 public static <E> Parser<Stream<Character>, Digit, E> digit(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isDigit(c))
       .map(c1 -> Digit.fromChar(c1).some());
 }
Beispiel #9
0
 /**
  * Returns a parser that produces a unicode identifier part character.
  *
  * @param missing The error if there is no character on the stream to produce a unicode
  *     identifier part character with.
  * @param sat The error if the produced character is not a unicode identifier part character.
  * @return A parser that produces a unicode identifier part character.
  * @see Character#isUnicodeIdentifierPart(char)
  */
 public static <E> Parser<Stream<Character>, Character, E> unicodeIdentiferPart(
     final F0<E> missing, final F<Character, E> sat) {
   return StreamParser.satisfy(missing, sat, c -> Character.isUnicodeIdentifierPart(c));
 }