| Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 |  | 
 | 2 | :mod:`token` --- Constants used with Python parse trees | 
 | 3 | ======================================================= | 
 | 4 |  | 
 | 5 | .. module:: token | 
 | 6 |    :synopsis: Constants representing terminal nodes of the parse tree. | 
 | 7 | .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org> | 
 | 8 |  | 
 | 9 |  | 
 | 10 | This module provides constants which represent the numeric values of leaf nodes | 
 | 11 | of the parse tree (terminal tokens).  Refer to the file :file:`Grammar/Grammar` | 
 | 12 | in the Python distribution for the definitions of the names in the context of | 
 | 13 | the language grammar.  The specific numeric values which the names map to may | 
 | 14 | change between Python versions. | 
 | 15 |  | 
 | 16 | This module also provides one data object and some functions.  The functions | 
 | 17 | mirror definitions in the Python C header files. | 
 | 18 |  | 
 | 19 |  | 
 | 20 | .. data:: tok_name | 
 | 21 |  | 
 | 22 |    Dictionary mapping the numeric values of the constants defined in this module | 
 | 23 |    back to name strings, allowing more human-readable representation of parse trees | 
 | 24 |    to be generated. | 
 | 25 |  | 
 | 26 |  | 
 | 27 | .. function:: ISTERMINAL(x) | 
 | 28 |  | 
 | 29 |    Return true for terminal token values. | 
 | 30 |  | 
 | 31 |  | 
 | 32 | .. function:: ISNONTERMINAL(x) | 
 | 33 |  | 
 | 34 |    Return true for non-terminal token values. | 
 | 35 |  | 
 | 36 |  | 
 | 37 | .. function:: ISEOF(x) | 
 | 38 |  | 
 | 39 |    Return true if *x* is the marker indicating the end of input. | 
 | 40 |  | 
 | 41 |  | 
 | 42 | .. seealso:: | 
 | 43 |  | 
 | 44 |    Module :mod:`parser` | 
 | 45 |       The second example for the :mod:`parser` module shows how to use the | 
 | 46 |       :mod:`symbol` module. | 
 | 47 |  |