Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

ParseToken (lines 1570-1599)

1570  !  ParseToken(type, data):
1571  !      Parses the given token, from the current word number wn, with exactly
1572  !      the specification of a general parsing routine.
1573  !      (Except that for "topic" tokens and prepositions, you need to supply
1574  !      a position in a valid grammar line as third argument.)
1575  !
1576  !  Returns:
1577  !    GPR_REPARSE  for "reconstructed input, please re-parse from scratch"
1578  !    GPR_PREPOSITION  for "token accepted with no result"
1579  !    $ff00 + x    for "please parse ParseToken(ELEMENTARY_TT, x) instead"
1580  !    0            for "token accepted, result is the multiple object list"
1581  !    1            for "token accepted, result is the number in parsed_number"
1582  !    object num   for "token accepted with this object as result"
1583  !    -1           for "token rejected"
1584  !
1585  !  (A)            Analyse the token; handle all tokens not involving
1586  !                 object lists and break down others into elementary tokens
1587  !  (B)            Begin parsing an object list
1588  !  (C)            Parse descriptors (articles, pronouns, etc.) in the list
1589  !  (D)            Parse an object name
1590  !  (E)            Parse connectives ("and", "but", etc.) and go back to (C)
1591  !  (F)            Return the conclusion of parsing an object list
1592  ! ----------------------------------------------------------------------------
1593   
1594  [ ParseToken given_ttype given_tdata token_n x y;
1595    x = lookahead; lookahead = NOUN_TOKEN;
1596    y = ParseToken__(given_ttype,given_tdata,token_n);
1597    if (y == GPR_REPARSE) Tokenise__(buffer,parse);
1598    lookahead = x; return y;
1599  ];


Last updated 27 February 2004. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.