摘要 |
A method and apparatus parses a command using a tree of acceptable command tokens. Each token is matched to a node in the tree, and upon discovering a match, descendant nodes of the matched node are used to parse the remaining tokens in the command received. When the command is fully parsed, or as the command is being parsed, pointers to nodes of the tree corresponding to a command parsed are stored along with a token from each such node matching the command token for use by the next command to be parsed. When the next command is received, the stored tokens are compared with each command token in the command until the tokens do not match the command token. The remainder of the command token is then parsed using the tree starting with the node corresponding to the last stored token that matched a command token.
|