X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/e0808c472145fc81e52898bc9ac289e10c4f4f41..c6ec484fcf13c0faab6ce5bbbb6ff510387763a5:/doc/parsing.tex

diff --git a/doc/parsing.tex b/doc/parsing.tex
index 28a747b..20ade82 100644
--- a/doc/parsing.tex
+++ b/doc/parsing.tex
@@ -43,6 +43,13 @@ consumed any input items.
 \begin{describe}{fun}{combine-parser-failures @<failures> @> @<list>}
 \end{describe}
 
+\begin{describe}{fun}{parse-empty \&optional @<value> @> @<function>}
+\end{describe}
+
+\begin{describe}{fun}
+    {parse-fail @<indicator> \&optional @<consumedp> @> @<function>}
+\end{describe}
+
 %%%--------------------------------------------------------------------------
 \section{File locations} \label{sec:parsing.floc}
 
@@ -82,31 +89,31 @@ consumed any input items.
 \begin{describe*}
     {\quad\=\quad\=\kill
      \dhead{cls}
-      {error-with-location (condition-with-location error) \\ \>
-        \&key :location}
-    \dhead{cls}
-      {warning-with-location (condition-with-location warning) \\ \>
-        \&key :location}
-    \dhead{cls}
-      {enclosing-error-with-location
-          (enclosing-error-with-location error) \\ \>
-        \&key :condition :location}
-    \dhead{cls}
-      {enclosing-warning-with-location
-          (enclosing-condition-with-location warning) \\ \>
-        \&key :condition :location}
+       {error-with-location (condition-with-location error)     \\ \>
+         \&key :location}
+     \dhead{cls}
+       {warning-with-location (condition-with-location warning) \\ \>
+         \&key :location}
+     \dhead{cls}
+       {enclosing-error-with-location
+           (enclosing-error-with-location error)                \\ \>
+         \&key :condition :location}
      \dhead{cls}
-      {simple-condition-with-location
-          (condition-with-location simple-condition) \\ \>
-        \&key :format-control :format-arguments :location}
+       {enclosing-warning-with-location
+           (enclosing-condition-with-location warning)          \\ \>
+         \&key :condition :location}
      \dhead{cls}
-      {simple-error-with-location
-          (error-with-location simple-error) \\ \>
-        \&key :format-control :format-arguments :location}
-    \dhead{cls}
-      {simple-warning-with-location
-          (warning-with-location simple-warning) \\ \>
-        \&key :format-control :format-arguments :location}}
+       {simple-condition-with-location
+           (condition-with-location simple-condition)           \\ \>
+         \&key :format-control :format-arguments :location}
+     \dhead{cls}
+       {simple-error-with-location
+           (error-with-location simple-error)                   \\ \>
+         \&key :format-control :format-arguments :location}
+     \dhead{cls}
+       {simple-warning-with-location
+           (warning-with-location simple-warning)               \\ \>
+         \&key :format-control :format-arguments :location}}
 \end{describe*}
 
 \begin{describe}{fun}
@@ -212,10 +219,10 @@ the scanner and read that data again.  Therefore it's possible to
 \begin{describe}{mac}
     {with-scanner-place (@<place> @<scanner>) @<declarations>^* @<form>^*
       @> @<value>^*}
-  Capture the @<scanner>'s current position as a place, evaluate the
-  @<body-form>s as an implicit progn with the variable @<place> bound to the captured
-  place.  When control leaves the @<body-form>s, the place is released.  The return
-  values are the values of the final @<body-form>.
+  Capture the @<scanner>'s current position as a place, evaluate the @<form>s
+  as an implicit progn with the variable @<place> bound to the captured
+  place.  When control leaves the @<form>s, the place is released.  The
+  return values are the values of the final @<form>.
 \end{describe}
 
 \subsection{Scanner file-location protocol} \label{sec:parsing.scanner.floc}
@@ -370,8 +377,8 @@ file-location protocols.
   characters from a scanner in bulk.  The function @<func> is invoked
   repeatedly, as if by
   \begin{prog}
-    (multiple-value-bind (@<donep> @<used>) \\ \ind\ind
-        (funcall @<func> @<buf> @<start> @<end>) \- \\
+    (multiple-value-bind (@<donep> @<used>)                     \\ \ind\ind
+        (funcall @<func> @<buf> @<start> @<end>)              \-\\
       \textrm\ldots)
   \end{prog}
   The argument @<buf> is a simple string; @<start> and @<end> are two
@@ -387,8 +394,8 @@ file-location protocols.
   fails: the @<fail> function is called with no arguments, and is expected to
   return two values.  If omitted, @<fail> defaults to
   \begin{prog}
-    (lambda () \\ \ind
-      (values nil nil))%
+    (lambda ()                                                  \\ \ind
+      (values nil nil))
   \end{prog}
 
   The @|charbuf-scanner-map| function returns three values.  The first value
@@ -447,18 +454,18 @@ file-location protocols.
 
 \begin{describe}{mac}
     {defparse @<name> (@[[ :context (@<var> @<context-class>) @]]
-                       @<destructuring-lambda-list-item>^*) \\ \ind
-      @[[ @<declaration>^* @! @<doc-string> @]] \\
-      @<form>^* \-
-     \nlret @<name>}
+                       @<destructuring-lambda-list-item>^*)     \\ \ind
+      @[[ @<declaration>^* @! @<doc-string> @]]                 \\
+      @<form>^*
+     \-\nlret @<name>}
 \end{describe}
 
 \begin{describe}{mac}
     {with-parser-context
-        (@<context-class> @{ @<init-keyword> @<value> @}^*) \\ \ind
-      @<declaration>^* \\
-      @<form>^* \-
-     \nlret @<value>^*}
+        (@<context-class> @{ @<init-keyword> @<value> @}^*)     \\ \ind
+      @<declaration>^*                                          \\
+      @<form>^*
+     \-\nlret @<value>^*}
 \end{describe}
 
 \begin{describe}{lmac}
@@ -483,26 +490,26 @@ file-location protocols.
 
 \begin{describe}{mac}
     {if-parse (@[[ \=:result @<result-var> @!
-                     :expected @<expected-var> @! \+ \\
-                     :consumedp @<consumed-var> @]]) \- \\ \ind\ind
-        @<parser> \- \\
-      @<consequent> \\
-      @[@<alternatve>@] \-
-     \nlret @<value>^*}
+                     :expected @<expected-var> @!             \+\\
+                     :consumedp @<consumed-var> @]])          \-\\ \ind\ind
+        @<parser>                                             \-\\
+      @<consequent>                                             \\
+      @[@<alternatve>@]
+     \-\nlret @<value>^*}
 \end{describe}
 
 \begin{describe}{mac}
-    {when-parse (@[@<result-var>@]) @<parser> \\ \ind
-      @<form>^* \-
-     \nlret @<value>^*}
+    {when-parse (@[@<result-var>@]) @<parser>                   \\ \ind
+      @<form>^*
+     \-\nlret @<value>^*}
 \end{describe}
 
 \begin{describe}{mac}
     {cond-parse (@[[ \=:result @<result-var> @!
-                       :expected @<expected-var> @! \+ \\
-                       :consumedp @<consumed-var> @]]) \- \\ \ind
-      @{ (@<parser> @<form>^*) @}^* \-
-     \nlret @<value>^*}
+                       :expected @<expected-var> @!           \+\\
+                       :consumedp @<consumed-var> @]])        \-\\ \ind
+      @{ (@<parser> @<form>^*) @}^*
+     \-\nlret @<value>^*}
 \end{describe}
 
 \begin{describe}{parse}{:eof}
@@ -530,8 +537,9 @@ file-location protocols.
 \end{describe}
 
 \begin{describe}{parseform}
-    {seq (@{ @<atomic-parser-spec> @! (@[@<var>@] @<parser>) @}^*) \\ \ind
-      @<body-form>^*}
+    {seq (@{ @<atomic-parser-spec> @!
+             (@[@<var>@] @<parser>) @}^*)                       \\ \ind
+      @<form>^*}
 \end{describe}
 
 \begin{describe}{parseform}{and @<parser>^*}
@@ -544,22 +552,22 @@ file-location protocols.
 \end{describe}
 
 \begin{describe}{parseform}
-    {many (\=@<accumulator-var> @<init-form> @<update-form> \+ \\
-           @[[ \=:new @<new-var> @! :final @<final-form> @! \+ \\
-                 :min @<minimum> @! :max @<maximum> @! \\
-                 :commitp @<commitp> @]]) \-\- \\ \ind
+    {many (\=@<accumulator-var> @<init-form> @<update-form>   \+\\
+           @[[ \=:new @<new-var> @! :final @<final-form> @!   \+\\
+                 :min @<minimum> @! :max @<maximum> @!          \\
+                 :commitp @<commitp> @]])                   \-\-\\ \ind
       @<item-parser> @[@<sep-parser>@]}
 \end{describe}
 
 \begin{describe}{parseform}
     {list (@[[ :min @<minimum> @! :max @<maximum> @!
-               :commitp @<commitp> @]])\\ \ind
+               :commitp @<commitp> @]])                         \\ \ind
       @<item-parser> @[@<sep-parser>@]}
 \end{describe}
 
 \begin{describe}{parseform}
     {skip-many (@[[ :min @<minimum> @! :max @<maximum> @!
-                    :commitp @<commitp> @]])\\ \ind
+                    :commitp @<commitp> @]])                    \\ \ind
       @<item-parser> @[@<sep-parser>@]}
 \end{describe}
 
@@ -601,6 +609,9 @@ file-location protocols.
 \begin{describe}{parseform}{peek @<parser>}
 \end{describe}
 
+\begin{describe}{parseform}{commit}
+\end{describe}
+
 \begin{describe}{cls}{character-parser-context () \&key}
 \end{describe}
 
@@ -682,7 +693,7 @@ file-location protocols.
 \end{describe}
 
 \begin{describe}{parseform}
-    {expr \=(@[[ :nestedp @<nestedp-var> @]]) \+ \\
+    {expr \=(@[[ :nestedp @<nestedp-var> @]])                 \+\\
             @<operand-parser> @<binop-parser>
             @<preop-parser> @<postop-parser>}
 \end{describe}
@@ -708,12 +719,13 @@ file-location protocols.
 
 \begin{describe*}
     {\quad\=\kill
-     \dhead{cls}{simple-binary-operator (simple-operator) \\ \>
-                  \&key :name :function :lprec :rprec :associativity}
+     \dhead{cls}{simple-binary-operator (simple-operator)       \\ \>
+                  \&key :name :function
+                        :lprec :rprec :associativity}
      \dhead{cls}{simple-postfix-operator (simple-unary-operator) \\ \>
                   \&key :name :function :lprec :rprec}
      \dhead{cls}{simple-prefix-operator
-                    (prefix-operator simple-unary-operator) \\ \>
+                    (prefix-operator simple-unary-operator)     \\ \>
                   \&key :name :function :rprec}}
 \end{describe*}
 
@@ -763,7 +775,9 @@ file-location protocols.
     {skip-until (@[[ :keep-end @<keep-end-flag> @]]) @<token-type>^*}
 \end{describe}
 
-\begin{describe}{parseform}{error () @<sub-parser> @<recover-parser>}
+\begin{describe}{parseform}
+    {error (@[[ :ignore-unconsumed @<flag> @]])                 \\ \ind
+      @<sub-parser> @<recover-parser>}
 \end{describe}
 
 \begin{describe}{fun}
