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