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

Robin Sommer robin at icir.org
Thu Jul 27 07:37:39 PDT 2017



On Wed, Jul 26, 2017 at 11:38 -0400, you wrote:

> ws_messages : list<WS_Message> &until(($$.first2B.op == 8 ) || ( &eod));

Interesting, I don't think Spicy can support this combination of two
conditions for terminating the list yet. &eod works only by itself,
not as part of another expression. A possible construct we could add
for cases like this might be a new "break" statement, like this:

    ws_messages : list<WS_Message> &eod
       &foreach { if ( $$.first2B.op == 8 ) break; }

That said, there may be a ways to work around the lack of support. I'm
not too familiar with WebSocket, would it be possible to just skip the
opcode check altogether and just process any messages until the end of
the connection (i.e., skip the &until, just use &eod)? Or could there
something else to parse still, that's not a message, after that close
opcode has come in?

Robin

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


More information about the HILTI mailing list