Function lineComment

  • Parse single-line comments:

    const elm = lineComment("--");

    const js = lineComment("//");

    const python = lineComment("#");

    This parser is defined like this:

    const lineComment = (str: string): Parser<Unit> =>
    skip2nd<Unit>(symbol(str))(chompUntilEndOr("\n"));

    So it will consume the remainder of the line. If the file ends before you see a newline, that is fine too.

    Parameters

    • str: string

    Returns Simple.Parser<Symbol>