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