Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

AnalyseToken (lines 428-510)

0428  Object selfobj "(self object)"
0429    with short_name
0430         [;  return L__M(##Miscellany, 18);
0431         ],
0432         description
0433         [;  return L__M(##Miscellany, 19);
0434         ],
0435         before NULL,   after NULL,    life NULL,    each_turn NULL,
0436         time_out NULL, describe NULL,
0437         capacity 100, parse_name 0,
0438         orders 0, number 0,
0439    has  concealed animate proper transparent;
0440   
0441  ! ============================================================================
0442  !  The definition of the token-numbering system used by Inform.
0443  ! ----------------------------------------------------------------------------
0444   
0445  Constant ILLEGAL_TT        = 0;      ! Types of grammar token: illegal
0446  Constant ELEMENTARY_TT     = 1;      !     (one of those below)
0447  Constant PREPOSITION_TT    = 2;      !     e.g. 'into'
0448  Constant ROUTINE_FILTER_TT = 3;      !     e.g. noun=CagedCreature
0449  Constant ATTR_FILTER_TT    = 4;      !     e.g. edible
0450  Constant SCOPE_TT          = 5;      !     e.g. scope=Spells
0451  Constant GPR_TT            = 6;      !     a general parsing routine
0452   
0453  Constant NOUN_TOKEN        = 0;      ! The elementary grammar tokens, and
0454  Constant HELD_TOKEN        = 1;      ! the numbers compiled by Inform to
0455  Constant MULTI_TOKEN       = 2;      ! encode them
0456  Constant MULTIHELD_TOKEN   = 3;
0457  Constant MULTIEXCEPT_TOKEN = 4;
0458  Constant MULTIINSIDE_TOKEN = 5;
0459  Constant CREATURE_TOKEN    = 6;
0460  Constant SPECIAL_TOKEN     = 7;
0461  Constant NUMBER_TOKEN      = 8;
0462  Constant TOPIC_TOKEN       = 9;
0463   
0464   
0465  Constant GPR_FAIL          = -1;     ! Return values from General Parsing
0466  Constant GPR_PREPOSITION   = 0;      ! Routines
0467  Constant GPR_NUMBER        = 1;
0468  Constant GPR_MULTIPLE      = 2;
0469  Constant GPR_REPARSE       = REPARSE_CODE;
0470  Constant GPR_NOUN          = $ff00;
0471  Constant GPR_HELD          = $ff01;
0472  Constant GPR_MULTI         = $ff02;
0473  Constant GPR_MULTIHELD     = $ff03;
0474  Constant GPR_MULTIEXCEPT   = $ff04;
0475  Constant GPR_MULTIINSIDE   = $ff05;
0476  Constant GPR_CREATURE      = $ff06;
0477   
0478  Constant ENDIT_TOKEN       = 15;     ! Value used to mean "end of grammar line"
0479   
0480  #Iftrue Grammar__Version == 1;
0481  [ AnalyseToken token m;
0482   
0483      found_tdata = token;
0484   
0485      if (token < 0)   { found_ttype = ILLEGAL_TT; return; }
0486      if (token <= 8)  { found_ttype = ELEMENTARY_TT; return; }
0487      if (token < 15)  { found_ttype = ILLEGAL_TT; return; }
0488      if (token == 15) { found_ttype = ELEMENTARY_TT; return; }
0489      if (token < 48)  { found_ttype = ROUTINE_FILTER_TT;
0490                         found_tdata = token - 16;
0491                         return; }
0492      if (token < 80)  { found_ttype = GPR_TT;
0493                         found_tdata = #preactions_table-->(token-48);
0494                         return; }
0495      if (token < 128) { found_ttype = SCOPE_TT;
0496                         found_tdata = #preactions_table-->(token-80);
0497                         return; }
0498      if (token < 180) { found_ttype = ATTR_FILTER_TT;
0499                         found_tdata = token - 128;
0500                         return; }
0501   
0502      found_ttype = PREPOSITION_TT;
0503      m=#adjectives_table;
0504      for (::)
0505      {   if (token==m-->1) { found_tdata = m-->0; return; }
0506          m=m+4;
0507      }
0508      m=#adjectives_table; RunTimeError(1);
0509      found_tdata = m;
0510  ];


Last updated 27 February 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.