Thomas Adam <[email protected]> writes:
> * Tokenisation in the form key/value means that each command can lookup
> the data in the same way. For instance:
>
> if (has_token("level")) {
> int l = strtonum(get_token("level"), 1, INT_MAX, NULL);
> if (l > 10)
> fprintf(stderr, "Sorry, break level too high!\n");
> }
Comments:
What you show above tells me we have 2 functions "has_token" and
"get_token" that as a result of a parser can retrieve parts of the
command just parsed using a token in the command.
Doesn't imply some kind of hash table?
I would expect a table driven parser to have a table representing the
commands arguments.
Maybe:
Animated_Move = {"int", &x,
"int", &y,
"keyword", "WARP", &warp_keyword};
Then the logic in the CMD_ANIMATED_MOVE would be
getting at it's parsed values differently:
this_am_x = &x;
this_am_y = &y;
this_am)_warp = FALSE;
if (&warp_keyword) {
this_am_warp = TRUE;
}
--
Dan Espen