Package fj.parser

Class Parser.StreamParser

  • Enclosing class:
    Parser<I,​A,​E>

    public static final class Parser.StreamParser
    extends java.lang.Object
    Parsers that accept Stream input.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private StreamParser()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <I,​E>
      Parser<Stream<I>,​I,​E>
      element​(E e)
      Returns a parser that produces an element from the stream if it is available and fails otherwise.
      static <I,​E>
      Parser<Stream<I>,​I,​E>
      element​(F0<E> e)
      Returns a parser that produces an element from the stream if it is available and fails otherwise.
      static <I,​E>
      Parser<Stream<I>,​I,​E>
      satisfy​(E missing, F<I,​E> sat, F<I,​java.lang.Boolean> f)
      Returns a parser that produces an element from the stream that satisfies the given predicate, or fails.
      static <I,​E>
      Parser<Stream<I>,​I,​E>
      satisfy​(F0<E> missing, F<I,​E> sat, F<I,​java.lang.Boolean> f)
      Returns a parser that produces an element from the stream that satisfies the given predicate, or fails.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StreamParser

        private StreamParser()
    • Method Detail

      • element

        public static <I,​E> Parser<Stream<I>,​I,​E> element​(F0<E> e)
        Returns a parser that produces an element from the stream if it is available and fails otherwise.
        Parameters:
        e - The error to fail with if no element is available.
        Returns:
        A parser that produces an element from the stream if it is available and fails otherwise.
      • element

        public static <I,​E> Parser<Stream<I>,​I,​E> element​(E e)
        Returns a parser that produces an element from the stream if it is available and fails otherwise.
        Parameters:
        e - The error to fail with if no element is available.
        Returns:
        A parser that produces an element from the stream if it is available and fails otherwise.
      • satisfy

        public static <I,​E> Parser<Stream<I>,​I,​E> satisfy​(F0<E> missing,
                                                                            F<I,​E> sat,
                                                                            F<I,​java.lang.Boolean> f)
        Returns a parser that produces an element from the stream that satisfies the given predicate, or fails.
        Parameters:
        missing - The error if no element is available.
        sat - The error if the element does not satisfy the predicate.
        f - The predicate that the element should satisfy.
        Returns:
        A parser that produces an element from the stream that satisfies the given predicate, or fails.
      • satisfy

        public static <I,​E> Parser<Stream<I>,​I,​E> satisfy​(E missing,
                                                                            F<I,​E> sat,
                                                                            F<I,​java.lang.Boolean> f)
        Returns a parser that produces an element from the stream that satisfies the given predicate, or fails.
        Parameters:
        missing - The error if no element is available.
        sat - The error if the element does not satisfy the predicate.
        f - The predicate that the element should satisfy.
        Returns:
        A parser that produces an element from the stream that satisfies the given predicate, or fails.