Hi Paul, Quick check yesterday you have a stray "l" character between two code blocks:
method objectKey($/) { make $<cstr>.made; }l # <-- WHAT'S THIS? method pairlist($/) { make $<pair>>>.made.flat; } I defer to Brad and Simon, otherwise. Best, Bill. On Sun, Dec 26, 2021 at 9:37 AM Brad Gilbert <b2gi...@gmail.com> wrote: > I'm on mobile, but without checking, I think the problem is here > > rule pairlist { <pair> * % \; } > > Specifically it's the missing % > > rule pairlist { <pair> * %% \; } > > JSON doesn't allow trailing commas or semicolons, so JSON::Tiny uses just > %. > Your data does have trailing semicolons, so you want to use %% instead. > > Also why did you change <object>, without actually changing anything? > > > On Sun, Dec 26, 2021, 3:22 AM Simon Proctor <simon.proc...@gmail.com> > wrote: > >> Still waking up but I think the issue is your pairlist has a semi colon >> divider but this should be after each pair. >> >> So the trailing semi colon after b is causing it to fail. >> >> On Sun, 26 Dec 2021, 06:01 Paul Procacci, <pproca...@gmail.com> wrote: >> >>> Hey all, >>> >>> Twas the night of Christmas, when all through the house, not a creature >>> was stirring except Paul w/ his mouse. >>> >>> Hope everyone had a Merry Christmas and takes likings to corny opening >>> statements. ;) >>> >>> I was writing a little something tonight using Grammars and ran into >>> something that I can't seem to wrap my head around. I'm hoping someone >>> could explain in detail. >>> >>> Given the following data: >>> ---- data ----- >>> objectKey: >>> { >>> a = "bi"; >>> b = "hi"; >>> } >>> ---- end data ----- >>> >>> >>> .... and the following logic partially taken from JSON::Tiny: >>> >>> ---- code ---- >>> grammar myTest { >>> token TOP { \s* <object> \s* } >>> rule object { <objectKey> '{' <pairlist> '}' } >>> # rule object { <objectKey> '{' ~ '}' <pairlist> } >>> rule objectKey { <cstr> ':' } >>> rule pairlist { <pair> * % \; } >>> rule pair { <cstr> '=' <value> } >>> token cstr { <alpha>+ } >>> token value { '"' ~ '"' <alpha>* } >>> } >>> >>> class myTestActions { >>> method TOP($/) { >>> make $<pairlist>.made.hash.item; >>> } >>> >>> method object($/) { >>> say 'hello'; >>> } >>> >>> method objectKey($/) { >>> make $<cstr>.made; >>> }l >>> method pairlist($/) { >>> make $<pair>>>.made.flat; >>> } >>> >>> method pair($/) { >>> make $<cstr>.made => $<value>.made; >>> } >>> >>> method cstr($/) { make ~$/ } >>> method value($/) { make ~$/ } >>> } >>> ---- code ---- >>> >>> >>> ... it'd be my hopes that this would match. However, It's not matching >>> on 'object' and I can't seem to figure out why. >>> >>> Adding Grammar::Tracer yields the following: >>> >>> TOP >>> | object >>> | | objectKey >>> | | | cstr >>> | | | * MATCH "objectKey" >>> | | * MATCH "objectKey:\n" >>> | | pairlist >>> | | | pair >>> | | | | cstr >>> | | | | * MATCH "a" >>> | | | | value >>> | | | | * MATCH "\"bi\"" >>> | | | * MATCH "a = \"bi\"" >>> | | | pair >>> | | | | cstr >>> | | | | * MATCH "b" >>> | | | | value >>> | | | | * MATCH "\"hi\"" >>> | | | * MATCH "b = \"hi\"" >>> | | | pair >>> | | | | cstr >>> | | | | * FAIL >>> | | | * FAIL >>> | | * MATCH "a = \"bi\";\n\tb = \"hi\"" >>> | * FAIL >>> * FAIL >>> >>> What exactly am I doing wrong? Does '{' ~ '}' not work as I expect >>> here? >>> Appreciate any insight. >>> >>> Thanks, >>> Paul >>> -- >>> __________________ >>> >>> :(){ :|:& };: >>> >>