zeek/spicy

LA based vector termination inside of LA based vector termination fails

Closed this issue · 0 comments

Given the input yz1z2z3yyz1x I would expect the following parser to parse into a structure like this...

{
  "y": [
    { "z": [{ "zb": "1" }, { "zb": "2" }, { "zb": "3" }] },
    {},
    { "z": [{ "zb": "1" }] }
  ],
  "x": "x"
}
module Test;

type Z = unit {
    : /z/;
    zb: bytes &size=1;
};

type Y = unit {
    : /y/;
    z: Z[];
};

public type X = unit {
    y: Y[];
    x: /x/;
};

When I run this I end up getting...

printf 'yz1z2z3yyz1x' | spicy-dump test3.spicy
[fatal error] terminating with uncaught exception of type spicy::rt::ParseError: no expected look-ahead token found (test3.spicy:14:5-14:11)

I'm not positive but it seems to be something related to the dual LA based vector termination. Vector termination this way works fine until I do one within another one.