[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Greetings and comments on MCP 2.1
>Let me give an algorithm for _data-tag less parsing of multiline data
>so that you can see how simple it is.
OK, let me give you an algorithim for parsing with _data-tags:
Represent an MCPMessage as a hashtable with some additional data (message
name and maybe an auth key). The Hashtable maps from String key to either
String (single line) or Vector (multiline). The MCPMessage object knows if
it has any multiline values. The internal parser state is a single
hashtable mapping from data_tags to "pending message objects".
>Case of a start message line:
Parse the line creating an MCPMessage object, filling the value part of
the Hashtable with the value or an empty Vector depending on if it is
multiline. If the MCPMessage contains any multiline values, put it in the
"pending" table with the data tag as the key.
>Case of a continuation line:
Parse the continuation line into a data tag, key name, and value. If the
data tag matches a pending message in the pending message hashtable, append
the line to the vector associated with the key name (or not, if there isn't
>Case of an end message line:
Dispatch the message associated with the data tag in the end message
line, if there is one.
I guess I don't see how the data_tag-less way is any less complicated. The
two methods seem to be very close in degree of complication.