Skip to content

Backtracking with context #330

@DenisNovac

Description

@DenisNovac

Hi everyone. So i am having this list of parsers in my parser for each case it could possibly have (there is also a recursive parser above which uses this list of parsers for each next node and a lot of simple parsers inside each):

parser1.withContext("parser 1").backtrack | 
  parser2.withContext("parser 2").backtrack |
  parser3.withContext("parser 3")

The problem is - i never getting any context except of "parser 3". I wonder if there is some trick to get output like:

Left(Error(4,NonEmptyList(
  WithContext(parser 2, 
    WithContext(parser 3,EndOfString(4,27))
  )
)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions