Skip to content

bug in repetitions #364

@RubenArtmann

Description

@RubenArtmann

grammar:

test = test:"a" "b" ("c" &{return test==="a" || error(`test = ${test}`);})|1..," "|

example:

abc c

resulting error: Line 1, column 6: test = b
even though the label test only gets set to a at the beginning

i have tried looking at the generated code:
it seems like you unwrap the loop into something like "c" {...} (" " "c" {...})*
but the second version looks for test in the wrong place (one higher in your stack??)


for now i can use this hack:

test = test:"a" ("" {return test;}) "b" ("c" &{return test==="a" || error(`test = ${test}`);})|1..," "|

but i shouldn't have to do that.

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