blob: 47f4750db3cf23ee73558cce7926769d0f55c9a2 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{token} ---
Fred Drakebbac4321999-02-20 00:14:17 +00002 Constants used with Python parse trees}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drakebbac4321999-02-20 00:14:17 +00004\declaremodule{standard}{token}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\modulesynopsis{Constants representing terminal nodes of the parse tree.}
Fred Drakebbac4321999-02-20 00:14:17 +00006\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
Fred Drakeb91e9341998-07-23 17:59:49 +00007
Fred Drakeb0df5671998-02-18 15:59:13 +00008
9This module provides constants which represent the numeric values of
10leaf nodes of the parse tree (terminal tokens). Refer to the file
Thomas Woutersf8316632000-07-16 19:01:10 +000011\file{Grammar/Grammar} in the Python distribution for the definitions
Fred Drakeb0df5671998-02-18 15:59:13 +000012of the names in the context of the language grammar. The specific
13numeric values which the names map to may change between Python
14versions.
15
16This module also provides one data object and some functions. The
17functions mirror definitions in the Python C header files.
18
Fred Drakeb0df5671998-02-18 15:59:13 +000019
20
21\begin{datadesc}{tok_name}
22Dictionary mapping the numeric values of the constants defined in this
23module back to name strings, allowing more human-readable
24representation of parse trees to be generated.
25\end{datadesc}
26
27\begin{funcdesc}{ISTERMINAL}{x}
28Return true for terminal token values.
29\end{funcdesc}
30
31\begin{funcdesc}{ISNONTERMINAL}{x}
32Return true for non-terminal token values.
33\end{funcdesc}
34
35\begin{funcdesc}{ISEOF}{x}
36Return true if \var{x} is the marker indicating the end of input.
37\end{funcdesc}
38
Fred Drakeba0a9892000-10-18 17:43:06 +000039
Fred Drakeb0df5671998-02-18 15:59:13 +000040\begin{seealso}
Fred Drakeba0a9892000-10-18 17:43:06 +000041 \seemodule{parser}{The second example for the \refmodule{parser}
42 module shows how to use the \module{symbol}
43 module.}
Fred Drakeb0df5671998-02-18 15:59:13 +000044\end{seealso}