blob: deec2c6da828308408449179f60ccee710ede7b8 [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
Fred Drakeb0df5671998-02-18 15:59:13 +000015
16
17\begin{datadesc}{tok_name}
18Dictionary mapping the numeric values of the constants defined in this
19module back to name strings, allowing more human-readable
20representation of parse trees to be generated.
21\end{datadesc}
22
23\begin{funcdesc}{ISTERMINAL}{x}
24Return true for terminal token values.
25\end{funcdesc}
26
27\begin{funcdesc}{ISNONTERMINAL}{x}
28Return true for non-terminal token values.
29\end{funcdesc}
30
31\begin{funcdesc}{ISEOF}{x}
32Return true if \var{x} is the marker indicating the end of input.
33\end{funcdesc}
34
35\begin{seealso}
36\seemodule{parser}{second example uses this module}
37\end{seealso}