Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e061a51

Browse files
committed
Minor nits (Lib/token.py is a file, token is a module...).
Added docs for symbol and token modules at the end.
1 parent db12f34 commit e061a51

2 files changed

Lines changed: 104 additions & 4 deletions

File tree

Doc/lib/libparser.tex

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ \section{Built-in Module \sectcode{parser}}
5353
one. The first element is an integer which identifies a production in
5454
the grammar. These integers are given symbolic names in the C header
5555
file \file{Include/graminit.h} and the Python module
56-
\file{Lib/symbol.py}. Each additional element of the sequence represents
56+
\code{symbol}. Each additional element of the sequence represents
5757
a component of the production as recognized in the input string: these
5858
are always sequences which have the same form as the parent. An
5959
important aspect of this structure which should be noted is that
@@ -72,7 +72,7 @@ \section{Built-in Module \sectcode{parser}}
7272
identified. The example of the \code{if} keyword above is
7373
representative. The various types of terminal symbols are defined in
7474
the C header file \file{Include/token.h} and the Python module
75-
\file{Lib/token.py}.
75+
\code{token}.
7676

7777
The AST objects are not required to support the functionality of this
7878
module, but are provided for three purposes: to allow an application
@@ -677,5 +677,55 @@ \subsubsection{Information Discovery}
677677
provide additional capabilities.
678678

679679

680+
\section{Standard Module \sectcode{symbol}}
681+
\stmodindex{symbol}
682+
683+
This module provides constants which represent the numeric values of
684+
internal nodes of the parse tree. Unlike most Python constants, these
685+
use lower-case names. Refer to the file \file{Grammar/Grammar} in the
686+
Python distribution for the defintions of the names in the context of
687+
the language grammar. The specific numeric values which the names map
688+
to may change between Python versions.
689+
690+
This module also provides one additional data object:
691+
692+
\begin{datadesc}{sym_name}
693+
Dictionary mapping the numeric values of the constants defined in this
694+
module back to name strings, allowing more human-readable
695+
representation of parse trees to be generated.
696+
\end{datadesc}
697+
698+
699+
\section{Standard Module \sectcode{token}}
700+
\stmodindex{token}
701+
702+
This module provides constants which represent the numeric values of
703+
leaf nodes of the parse tree (terminal tokens). Refer to the file
704+
\file{Grammar/Grammar} in the Python distribution for the defintions
705+
of the names in the context of the language grammar. The specific
706+
numeric values which the names map to may change between Python
707+
versions.
708+
709+
This module also provides one data object and some functions. The
710+
functions mirror definitions in the Python C header files.
711+
712+
\begin{datadesc}{tok_name}
713+
Dictionary mapping the numeric values of the constants defined in this
714+
module back to name strings, allowing more human-readable
715+
representation of parse trees to be generated.
716+
\end{datadesc}
717+
718+
\begin{funcdesc}{ISTERMINAL}{x}
719+
Return true for terminal token values.
720+
\end{funcdesc}
721+
722+
\begin{funcdesc}{ISNONTERMINAL}{x}
723+
Return true for non-terminal token values.
724+
\end{funcdesc}
725+
726+
\begin{funcdesc}{ISEOF}{x}
727+
Return true if \var{x} is the marker indicating the end of input.
728+
\end{funcdesc}
729+
680730
%%
681731
%% end of file

Doc/libparser.tex

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ \section{Built-in Module \sectcode{parser}}
5353
one. The first element is an integer which identifies a production in
5454
the grammar. These integers are given symbolic names in the C header
5555
file \file{Include/graminit.h} and the Python module
56-
\file{Lib/symbol.py}. Each additional element of the sequence represents
56+
\code{symbol}. Each additional element of the sequence represents
5757
a component of the production as recognized in the input string: these
5858
are always sequences which have the same form as the parent. An
5959
important aspect of this structure which should be noted is that
@@ -72,7 +72,7 @@ \section{Built-in Module \sectcode{parser}}
7272
identified. The example of the \code{if} keyword above is
7373
representative. The various types of terminal symbols are defined in
7474
the C header file \file{Include/token.h} and the Python module
75-
\file{Lib/token.py}.
75+
\code{token}.
7676

7777
The AST objects are not required to support the functionality of this
7878
module, but are provided for three purposes: to allow an application
@@ -677,5 +677,55 @@ \subsubsection{Information Discovery}
677677
provide additional capabilities.
678678

679679

680+
\section{Standard Module \sectcode{symbol}}
681+
\stmodindex{symbol}
682+
683+
This module provides constants which represent the numeric values of
684+
internal nodes of the parse tree. Unlike most Python constants, these
685+
use lower-case names. Refer to the file \file{Grammar/Grammar} in the
686+
Python distribution for the defintions of the names in the context of
687+
the language grammar. The specific numeric values which the names map
688+
to may change between Python versions.
689+
690+
This module also provides one additional data object:
691+
692+
\begin{datadesc}{sym_name}
693+
Dictionary mapping the numeric values of the constants defined in this
694+
module back to name strings, allowing more human-readable
695+
representation of parse trees to be generated.
696+
\end{datadesc}
697+
698+
699+
\section{Standard Module \sectcode{token}}
700+
\stmodindex{token}
701+
702+
This module provides constants which represent the numeric values of
703+
leaf nodes of the parse tree (terminal tokens). Refer to the file
704+
\file{Grammar/Grammar} in the Python distribution for the defintions
705+
of the names in the context of the language grammar. The specific
706+
numeric values which the names map to may change between Python
707+
versions.
708+
709+
This module also provides one data object and some functions. The
710+
functions mirror definitions in the Python C header files.
711+
712+
\begin{datadesc}{tok_name}
713+
Dictionary mapping the numeric values of the constants defined in this
714+
module back to name strings, allowing more human-readable
715+
representation of parse trees to be generated.
716+
\end{datadesc}
717+
718+
\begin{funcdesc}{ISTERMINAL}{x}
719+
Return true for terminal token values.
720+
\end{funcdesc}
721+
722+
\begin{funcdesc}{ISNONTERMINAL}{x}
723+
Return true for non-terminal token values.
724+
\end{funcdesc}
725+
726+
\begin{funcdesc}{ISEOF}{x}
727+
Return true if \var{x} is the marker indicating the end of input.
728+
\end{funcdesc}
729+
680730
%%
681731
%% end of file

0 commit comments

Comments
 (0)