Skip to content

add optOccurenceΒ #174

@Kreijstal

Description

@Kreijstal

I was looking through the source code, and apparently there is no way to add a parser dynamically, since the function repeatable is not available :(

it'd be nice if you could add something like

return repeatable(this, l => l < occurrence, l => l === occurrence);

optoccurrence(occurrence) {
        return repeatable(this, l => l < occurrence, () => true);
    }

or even

occurrencerange(start,end) {
      return repeatable(this, l => l < end,  l => l >= start);
}

or both?

I would love to do a pull request, but I have no idea about haskell, and I can't understand what something like "// Parser 'a 'c => unit -> Parser (List 'a) 'c" means, so out of fear of just being wrong, I will just ask politely here 😁.

Yes, I know you could use something like .opt().occurrence(x) however, it seems wasteful, when x is big

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions