Skip to content

Better position tracking #2

@davesnx

Description

@davesnx

From https://discuss.ocaml.org/t/ann-parseff-parser-combinator-library-for-ocaml-5/17914/4?u=davesnx

A real pain when writing parser is to handle locations with line number and character position on line. The Parseff interface seems to only provide a position from the beginning of the stream. Do you think it would be possible de provide more convenient positions, with absolute position, but also line number and position on line ?

What about a Parseff.location that returns type location = { offset : int; line : int; col : int }. We already handle offser and can store a mutable field line_index and derive col with position

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions