예제 #1
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));
 }
예제 #2
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));
 }
예제 #3
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));
 }
예제 #4
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));
 }
예제 #5
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));
 }
예제 #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));
 }
예제 #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));
 }
예제 #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());
 }
예제 #9
0
 /**
  * Returns a parser that produces the given character or fails otherwise.
  *
  * @param missing The error if no character is available.
  * @param sat The error if the produced character is not the one given.
  * @param c The character to produce in the parser.
  * @return A parser that produces the given character or fails otherwise.
  */
 public static <E> Parser<Stream<Character>, Character, E> character(
     final F0<E> missing, final F<Character, E> sat, final char c) {
   return StreamParser.satisfy(missing, sat, x -> x == c);
 }
예제 #10
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));
 }