| Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{token} --- | 
| Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 2 |          Constants used with Python parse trees} | 
| Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 3 |  | 
| Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{token} | 
| Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 5 | \modulesynopsis{Constants representing terminal nodes of the parse tree.} | 
| Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 6 | \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} | 
| Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 7 |  | 
| Fred Drake | b0df567 | 1998-02-18 15:59:13 +0000 | [diff] [blame] | 8 |  | 
 | 9 | This module provides constants which represent the numeric values of | 
 | 10 | leaf nodes of the parse tree (terminal tokens).  Refer to the file | 
 | 11 | \file{Grammar/Grammar} in the Python distribution for the defintions | 
 | 12 | of the names in the context of the language grammar.  The specific | 
 | 13 | numeric values which the names map to may change between Python | 
 | 14 | versions. | 
 | 15 |  | 
 | 16 | This module also provides one data object and some functions.  The | 
 | 17 | functions mirror definitions in the Python C header files. | 
 | 18 |  | 
| Fred Drake | b0df567 | 1998-02-18 15:59:13 +0000 | [diff] [blame] | 19 |  | 
 | 20 |  | 
 | 21 | \begin{datadesc}{tok_name} | 
 | 22 | Dictionary mapping the numeric values of the constants defined in this | 
 | 23 | module back to name strings, allowing more human-readable | 
 | 24 | representation of parse trees to be generated. | 
 | 25 | \end{datadesc} | 
 | 26 |  | 
 | 27 | \begin{funcdesc}{ISTERMINAL}{x} | 
 | 28 | Return true for terminal token values. | 
 | 29 | \end{funcdesc} | 
 | 30 |  | 
 | 31 | \begin{funcdesc}{ISNONTERMINAL}{x} | 
 | 32 | Return true for non-terminal token values. | 
 | 33 | \end{funcdesc} | 
 | 34 |  | 
 | 35 | \begin{funcdesc}{ISEOF}{x} | 
 | 36 | Return true if \var{x} is the marker indicating the end of input. | 
 | 37 | \end{funcdesc} | 
 | 38 |  | 
 | 39 | \begin{seealso} | 
 | 40 | \seemodule{parser}{second example uses this module} | 
 | 41 | \end{seealso} |