summaryrefslogtreecommitdiffstats
path: root/Doc/ref/ref8.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/ref/ref8.tex')
-rw-r--r--Doc/ref/ref8.tex28
1 files changed, 16 insertions, 12 deletions
diff --git a/Doc/ref/ref8.tex b/Doc/ref/ref8.tex
index 24d10b1..d10c87f 100644
--- a/Doc/ref/ref8.tex
+++ b/Doc/ref/ref8.tex
@@ -49,9 +49,10 @@ program.
All input read from non-interactive files has the same form:
-\begin{verbatim}
-file_input: (NEWLINE | statement)*
-\end{verbatim}
+\begin{productionlist}
+ \production{file_input}
+ {(NEWLINE | \token{statement})*}
+\end{productionlist}
This syntax is used in the following situations:
@@ -70,9 +71,10 @@ This syntax is used in the following situations:
Input in interactive mode is parsed using the following grammar:
-\begin{verbatim}
-interactive_input: [stmt_list] NEWLINE | compound_stmt NEWLINE
-\end{verbatim}
+\begin{productionlist}
+ \production{interactive_input}
+ {[\token{stmt_list}] NEWLINE | \token{compound_stmt} NEWLINE}
+\end{productionlist}
Note that a (top-level) compound statement must be followed by a blank
line in interactive mode; this is needed to help the parser detect the
@@ -87,16 +89,18 @@ whitespace.
The string argument to \function{eval()} must have the following form:
\bifuncindex{eval}
-\begin{verbatim}
-eval_input: expression_list NEWLINE*
-\end{verbatim}
+\begin{productionlist}
+ \production{eval_input}
+ {\token{expression_list} NEWLINE*}
+\end{productionlist}
The input line read by \function{input()} must have the following form:
\bifuncindex{input}
-\begin{verbatim}
-input_input: expression_list NEWLINE
-\end{verbatim}
+\begin{productionlist}
+ \production{input_input}
+ {\token{expression_list} NEWLINE}
+\end{productionlist}
Note: to read `raw' input line without interpretation, you can use the
built-in function \function{raw_input()} or the \method{readline()} method