chiark / gitweb /
lib/keyword.c (kw_parseempty): Use correct variable scanning `kwval' list.
[sod] / src / lexer-impl.lisp
index 16861793b9a269cb027a2b91d9ee6aae38ee9940..ccaca5c7254d336df73ece94b14dae4ec25ef651 100644 (file)
@@ -67,7 +67,7 @@ (defun %skip-until (scanner token-types
     (scanner-step scanner)))
 
 (defun parse-error-recover (scanner parser recover
     (scanner-step scanner)))
 
 (defun parse-error-recover (scanner parser recover
-                           &key ignore-unconsumed force-progress)
+                           &key ignore-unconsumed force-progress action)
   "This is the implementation of the `error' parser."
   (multiple-value-bind (result win consumedp) (funcall parser)
     (cond ((or win
   "This is the implementation of the `error' parser."
   (multiple-value-bind (result win consumedp) (funcall parser)
     (cond ((or win
@@ -93,6 +93,7 @@ (defun parse-error-recover (scanner parser recover
           ;; simply to propagate the current failure back to the caller, but
           ;; we handled that case above.
           (syntax-error scanner result)
           ;; simply to propagate the current failure back to the caller, but
           ;; we handled that case above.
           (syntax-error scanner result)
+          (when action (funcall action))
           (when (and force-progress (not consumedp)) (scanner-step scanner))
           (funcall recover)))))
 
           (when (and force-progress (not consumedp)) (scanner-step scanner))
           (funcall recover)))))
 
@@ -187,6 +188,14 @@ (defmethod scanner-token ((scanner sod-token-scanner))
 
          ;; Some special punctuation sequences are single tokens.
          ("..." (values :ellipsis nil))
 
          ;; Some special punctuation sequences are single tokens.
          ("..." (values :ellipsis nil))
+         ("==" (values :eq))
+         ("!=" (values :ne))
+         ("<=" (values :le))
+         (">=" (values :ge))
+         ("&&" (values :and))
+         ("||" (values :or))
+         ("<<" (values :shl))
+         (">>" (values :shr))
 
          ;; Any other character is punctuation.
          (:any (values it nil))
 
          ;; Any other character is punctuation.
          (:any (values it nil))