



ParseToken (lines 2213-2242)
Back to List
Browsing parserm.h
2213 ! ParseToken(type, data):
2214 ! Parses the given token, from the current word number wn, with exactly
2215 ! the specification of a general parsing routine.
2216 ! (Except that for "topic" tokens and prepositions, you need to supply
2217 ! a position in a valid grammar line as third argument.)
2218 !
2219 ! Returns:
2220 ! GPR_REPARSE for "reconstructed input, please re-parse from scratch"
2221 ! GPR_PREPOSITION for "token accepted with no result"
2222 ! $ff00 + x for "please parse ParseToken(ELEMENTARY_TT, x) instead"
2223 ! 0 for "token accepted, result is the multiple object list"
2224 ! 1 for "token accepted, result is the number in parsed_number"
2225 ! object num for "token accepted with this object as result"
2226 ! -1 for "token rejected"
2227 !
2228 ! (A) Analyse the token; handle all tokens not involving
2229 ! object lists and break down others into elementary tokens
2230 ! (B) Begin parsing an object list
2231 ! (C) Parse descriptors (articles, pronouns, etc.) in the list
2232 ! (D) Parse an object name
2233 ! (E) Parse connectives ("and", "but", etc.) and go back to (C)
2234 ! (F) Return the conclusion of parsing an object list
2235 ! ----------------------------------------------------------------------------
2236
2237 [ ParseToken given_ttype given_tdata token_n x y;
2238 x = lookahead; lookahead = NOUN_TOKEN;
2239 y = ParseToken__(given_ttype,given_tdata,token_n);
2240 if (y == GPR_REPARSE) Tokenise__(buffer,parse);
2241 lookahead = x; return y;
2242 ];
Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.