mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-10 14:00:05 +00:00
Inside a parser, how do I "back up" one character? #344
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @deanebarker on GitHub (Jan 26, 2020).
Assuming I've found my pattern, I also want to include the character before if it's a space. So I want to do something like this:
I saw the
Startproperty onStringSlice, but I can't figure out what character index I'm on now, so that didn't seem to help.@xoofx commented on GitHub (Jan 31, 2020):
I don't think we are able to handle this case easily. Once a parser has parsed a slice, it will transform it to its internal representation (and we are not fully 100% roundtrip ready, as we don't store all stuffs that a parser could discard e.g trailing spaces)...
So the easiest solution would be to trigger your parser on space and your characters, and match from that instead.