Skip to content

Character position setter / rewind #122

@valpackett

Description

@valpackett

I'm implementing look-behind in a parser library based on strscan; currently the only way to rewind the character position is this:

            pos = @str.charpos - nchars
            @str.reset
            @str.getch while @str.charpos < pos

which is not the most efficient it could be, with per-character roundtrips to the native extension and back to Ruby… Would be a lot nicer to have a setter for the character position and not just the byte one.

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