[HILTI] Spicy Parsing WebSockets - how to end a list

Robin Sommer robin at icir.org
Fri Jul 28 08:21:06 PDT 2017

On Thu, Jul 27, 2017 at 14:55 -0400, Jennifer wrote:

> Thanks for the response.  Unfortunately, the &eod doesn't work with a list,
> just with bytes.

Ah, of course, that's right for the attribute. However, thinking about
it, lists should actually be implicitly terminated by the end of the
input, even without any attribute. There's a test for that in

    module Test;

    export type test = unit {
        : list<b> &transient;

    type b = unit {
        a: uint8 {
            print self.a;

# echo -n 1234 | spicy-driver tests/spicy/list/eof.spicy

(The &transient doesn't make a difference.)

Are you getting an error message about a missing look-ahead token when
trying this with your list? If you send me the full Spicy code, I'll
see if I can figure out why, it might be that the parser generator
doesn't quite recognize the situation.

> Last night I started down another path. I am trying to use a sink
> construct.

Nice idea!

> Is there a way to make the Sub unit a part of the WS_Handshake unit?

If you pass the handshake unit to the new Sub unit
("self.sub.connect(new Sub(self))"), you can then use that inside Sub
to assign to variables stored inside the handshake unit, and bring the
information back that way. Does that help?


Robin Sommer * ICSI/LBNL * robin at icir.org * www.icir.org/robin

More information about the HILTI mailing list