@Test public void multiLevelContainers() { final byte[] l3Data = generateIncreasing(880); final Token l3Token = INC_PREV_MOD_100; checkFullParse(l3Token, l3Data); final byte[] l2Data = flipBlocks(l3Data, 40); final Token l2Token = seq(rep(seq(def("left", con(40)), def("right", con(40)))), tie(l3Token, fold(cat(ref("right"), ref("left")), Shorthand::cat))); checkFullParse(l2Token, l2Data); final byte[] l1Data = prefixSize(deflate(l2Data)); final Token l1Token = seq(def("size", con(4)), def("data", last(ref("size"))), tie(l2Token, inflate(last(ref("data"))))); final Optional<ParseState> result = checkFullParse(l1Token, l1Data); assertEquals(80, result.get().order.head.asGraph().head.asGraph().head.asGraph().head.asGraph().head.asGraph().head.asGraph().head.asValue().asNumeric().intValueExact()); }
public Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding) { super(name, encoding); this.token = checkNotNull(token, "token"); this.dataExpression = checkNotNull(dataExpression, "dataExpression"); }
Tie extends Token { public Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding) { super(name, encoding); this.token = checkNotNull(token, "token"); this.dataExpression = checkNotNull(dataExpression, "dataExpression"); } }
Tie extends Token { public Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding) { super(name, encoding); this.token = checkNotNull(token, "token"); this.dataExpression = checkNotNull(dataExpression, "dataExpression"); } Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding); }
Tie extends Token { public Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding) { super(name, encoding); this.token = checkNotNull(token, "token"); this.dataExpression = checkNotNull(dataExpression, "dataExpression"); } Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); }
Tie extends Token { public Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding) { super(name, encoding); this.token = checkNotNull(token, "token"); this.dataExpression = checkNotNull(dataExpression, "dataExpression"); } Tie(final String name, final Token token, final ValueExpression dataExpression, final Encoding encoding); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); final Token token; final ValueExpression dataExpression; }