Function regex

  • Defines a TokenParser that will match a regular expression regex.

    If no match was made and targer reached EOF, an error with a semantic error value returned by matchError gets returned. If no match was made, an error with a semantic error value returned by matchError gets returned.

    Returns

    A new TokenParser that will match regex.

    Type Parameters

    Parameters

    • regex: RegExp

      The regular expression to be matched.

    • EOFError: ParseErrorProduction<E>

      A callback that returns a semantic error value for "Unexpected EOF".

    • matchError: ParseErrorProduction<E>

      A callback that returns a semantic error value for "No match found".

    Returns TokenParser<D, E>