X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/40d95de71fca4c3b7b145d5ba73d1420e8854673..82567ea97e4f9374e8a3d586ea49ad9bf3dff3dc:/doc/parsing.tex diff --git a/doc/parsing.tex b/doc/parsing.tex index c91c74b..17f0ecb 100644 --- a/doc/parsing.tex +++ b/doc/parsing.tex @@ -51,6 +51,41 @@ consumed any input items. \end{describe} %%%-------------------------------------------------------------------------- +\section{Streams} \label{sec:parsing.streams} + +\begin{describe*} + {\dhead{cls}{position-aware-stream \&key :file :line :column} + \dhead{gf}{position-aware-stream-file @ @> @} + \dhead{gf}{setf (position-aware-stream-file @) @} + \dhead{gf}{position-aware-stream-line @ @> @} + \dhead{gf}{setf (position-aware-stream-line @) @} + \dhead{gf}{position-aware-stream-column @ @> @} + \dhead{gf}{setf (position-aware-stream-column @) @}} +\end{describe*} + +\begin{describe}{gf}{stream-pathname @ @> @} + \begin{describe}{meth}{stream} + {stream-pathname (@ stream) @> nil} + \end{describe} + \begin{describe}{meth}{file-stream} + {stream-pathname (@ file-stream) @> @} + \end{describe} + \begin{describe}{meth}{position-aware-stream} + {stream-pathname (@ position-aware-stream) @> @} + \end{describe} +\end{describe} + +\begin{describe}{gf}{stream-line-and-column @ @> @ @} + \begin{describe}{meth}{stream} + {stream-line-and-column (@ stream) @> nil nil} + \end{describe} + \begin{describe}{meth}{position-aware-stream} + {stream-line-and-column (@ position-aware-stream) + \nlret @ @} + \end{describe} +\end{describe} + +%%%-------------------------------------------------------------------------- \section{File locations} \label{sec:parsing.floc} \begin{describe}{cls}{file-location} @@ -71,18 +106,21 @@ consumed any input items. \end{describe*} \begin{describe}{gf}{file-location @ @> @} - \begin{describe}{meth}{file-location (@ file-location) @> @} + \begin{describe}{meth}{file-location} + {file-location (@ file-location) @> @} \end{describe} - \begin{describe}{meth}{file-location (@ stream) @> @} + \begin{describe}{meth}{stream} + {file-location (@ stream) @> @} \end{describe} - \begin{describe}{meth}{file-location (@ t) @> @} + \begin{describe}{meth}{t} + {file-location (@ t) @> @} \end{describe} \end{describe} \begin{describe}{cls}{condition-with-location (condition) \&key :location} \end{describe} -\begin{describe}{meth} +\begin{describe}{meth}{condition-with-location} {file-location (@ condition-with-location) @> @} \end{describe} @@ -175,14 +213,19 @@ consumed any input items. \begin{describe}{gf}{classify-condition @ @> @} \begin{describe*} - {\dhead{meth}{classify-condition (@ error) @> @} - \dhead{meth}{classify-condition (@ warning) @> @} - \dhead{meth}{classify-condition (@ information) - @> @} - \dhead{meth}{classify-condition (@ base-lexer-error) - @> @} - \dhead{meth}{classify-condition (@ base-syntax-error) - @> @}} + {\dhead{meth}{error} + {classify-condition (@ error) @> @} + \dhead{meth}{warning} + {classify-condition (@ warning) @> @} + \dhead{meth}{information} + {classify-condition (@ information) + @> @} + \dhead{meth}{base-lexer-error} + {classify-condition (@ base-lexer-error) + @> @} + \dhead{meth}{base-syntax-error} + {classify-condition (@ base-syntax-error) + @> @}} \end{describe*} \end{describe} @@ -241,7 +284,7 @@ depends on the type of scanner. Given a captured place, the scanner can be rewound to the position held in it. Depending on how the scanner works, holding onto a captured place might -consume a lot of memory or case poor performance. For example, if the +consume a lot of memory or cause poor performance. For example, if the scanner is reading from an input stream, having a captured place means that data from that point on must be buffered in case the program needs to rewind the scanner and read that data again. Therefore it's possible to @@ -327,7 +370,7 @@ Character scanners are scanners which read sequences of characters. \begin{describe}{gf}{scanner-unread @ @} Rewind the @ by one step. The @ must be the previous current character, and becomes the current character again. It is an error - if: the @ has reached end-of-file; the @ is never been + if: the @ has reached end-of-file; the @ has never been stepped; or @ was not the previous current character. \end{describe} @@ -421,7 +464,7 @@ file-location protocols. \begin{describe}{gf} {charbuf-scanner-map @ @ \&optional @ - \nlret @ @ @} + \nlret @ @ @} Read characters from the @'s buffers. This is intended to be an efficient and versatile interface for reading @@ -437,7 +480,7 @@ file-location protocols. @ (inclusive) and @ (exclusive) should be processed. If @'s return value @ is nil then @ is ignored: the function has consumed the entire buffer and wishes to read more. If - @ is non-nil, then it must be a fixnum such that $@ \le + @ is non-nil, then @ must be a fixnum such that $@ \le @ \le @$: the function has consumed the buffer as far as @ (exclusive) and has completed successfully. @@ -536,9 +579,6 @@ file-location protocols. \begin{describe}{gf}{parser-step @ @> @
} \end{describe} -\begin{describe}{sym}{it} -\end{describe} - \begin{describe}{mac} {if-parse (@[[ \=:result @ @! :expected @ @! \+\\ @@ -648,7 +688,7 @@ file-location protocols. \end{describe} \begin{describe}{gf} - {parser-places-must-be-released-p @ @> @>} + {parser-places-must-be-released-p @ @> @} \end{describe} \begin{describe}{mac} @@ -676,10 +716,10 @@ file-location protocols. \begin{describe}{parseform}{char @} \end{describe} -\begin{describe}[char]{parse}{@} +\begin{describe}{parse}[char]{@} \end{describe} -\begin{describe}[string]{parse}{@} +\begin{describe}{parse}[string]{@} \end{describe} \begin{describe}{parse}{:any} @@ -709,10 +749,7 @@ file-location protocols. \begin{describe}{parseform}{token @ @[@@] @[:peekp @@]} \end{describe} -\begin{describe}[atom]{parse}{@} -\end{describe} - -\begin{describe}[string]{parse}{@} +\begin{describe}{parse}[atom]{@} \end{describe} \begin{describe}{cls}{scanner-context () \&key :scanner} @@ -836,8 +873,10 @@ file-location protocols. \begin{describe}{parseform} {error (@[[ :ignore-unconsumed @ @! - :force-process @ @]]) \\ \ind - @ @} + :force-process @ @]]) \\ \ind\ind + @ @ \-\\ + @^* \\ + @^*} \end{describe} \begin{describe}{parseform}{must @ @[@@]}