Open paulstansifer opened 5 years ago
The proposed method isn't a complete fix; what if we have Star(Star(Named(...))
? You might have 5 copies at the first layer, each of which has zero copies, or you might have zero copies at the first layer (and the difference might matter).
The current representation for EnvMBE
s is bad (#45), but I've made it more possible to represent zero-repetition repeats in this commit: https://github.com/paulstansifer/unseemly/commit/4973d811fe2485bdfbc388cae9160cfd6415e226
When we assemble a
Node
from its constituentAst
, we should check to see if anyNamed
names in its grammar are absent from the parse result so far. If so, we should store them as zero copies of a repeated term because that's (presumably) what they are.(They could also be under a branch of an
Alt
, but this seems like it's still an improvement in this case.)See the TODO in
earley::c_parse
, in theScope
case.End-to-end test that otherwise fails: