Commits

Anonymous committed 2dbc890

Use none-of* when possible

Comments (0)

Files changed (1)

                 (list el content)))))
 
 (define end-of-input
-  (preceded-by (none-of item) (result #\newline)))
+  (none-of* item (result #\newline)))
 
 (define space-chars
   (char-set #\space #\tab))
   (satisfies normal-chars))
 
 (define non-space-char
-  (preceded-by (none-of space-char new-line) item))
+  (none-of* space-char new-line item))
 
 (define-syntax mutually-recursive-parser
   (syntax-rules ()
                           (is delimiter)
                           space*
                           (any-of (is #\)) new-line))
-                         (none-of)
-                         (preceded-by item)
+                         (none-of* item)
                          (zero-or-more)
                          (as-string)))
               (_ (is delimiter)))
 (define link-label
   (mutually-recursive-parser
    (enclosed-by (is #\[)
-                (sequence* ((text (-> (none-of (is #\[) (is #\]))
-                                      (preceded-by inline)
+                (sequence* ((text (-> (none-of* (is #\[ #\]) inline)
                                       (zero-or-more)))
                             (label (maybe (link-label))))
                   (result (if label
 
 (define explicit-link-source-contents
   (mutually-recursive-parser
-   (-> (none-of (satisfies (char-set #\( #\) #\>)))
-       (preceded-by non-space-char)
+   (-> (is #\( #\) #\>)
+       (none-of* non-space-char)
        (one-or-more)
        (any-of (sequence (is #\() (explicit-link-source-contents) (is #\))))
        (zero-or-more)
               (email (-> (sequence
                            (one-or-more (satisfies #[-a-za-z0-9+_./!%~$]))
                            (is #\@)
-                           (one-or-more (preceded-by (none-of new-line (is #\>)) item)))
+                           (one-or-more (none-of* new-line (is #\>) item)))
                          (as-string)))
               (_ (is #\>)))
     (result `(auto-link
   (sequence* ((_ (is #\<))
               (uri (-> (sequence (one-or-more (satisfies #[a-za-z]))
                                  (char-seq "://")
-                                 (-> (none-of new-line (is #\>))
-                                     (preceded-by item)
+                                 (-> (none-of* new-line (is #\>) item)
                                      (one-or-more)))
                        (as-string)))
               (_ (is #\>)))
     (preceded-by (none-of (line-of char))
                  parser
                  (none-of space-char new-line)
-                 (sequence* ((x (-> (preceded-by (none-of close) inline)
+                 (sequence* ((x (-> (none-of* close inline)
                                     (zero-or-more)))
                              (y close))
                    (result (append x (list y)))))))
                          (as-string)))
               (_  space*)
               (code (->> (any-of space-char (preceded-by new-line (none-of blank-line)))
-                         (preceded-by (none-of (preceded-by space* (char-seq ticks))))
-                         (any-of (one-or-more (preceded-by (none-of (is #\`)) non-space-char))
-                                 (preceded-by (none-of (char-seq ticks)) (one-or-more (is #\`))))
+                         (none-of* (preceded-by space* (char-seq ticks)))
+                         (any-of (one-or-more (none-of* (is #\`) non-space-char))
+                                 (none-of* (char-seq ticks) (one-or-more (is #\`))))
                          (one-or-more)
                          (as-string)
                          (node 'code)))
 (define quoted
   (let ((delimiters (satisfies (char-set #\" #\'))))
     (sequence* ((delimiter delimiters)
-                (text (zero-or-more (preceded-by (none-of (is delimiter)) item)))
+                (text (zero-or-more (none-of* (is delimiter) item)))
                 (_ (is delimiter)))
       (result text))))
 
   (preceded-by (is #\=)
                space-new-line
                (->> non-space-char
-                    (preceded-by (none-of (is #\>)))
+                    (none-of* (is #\>))
                     (one-or-more)
                     (any-of quoted)
                     (as-string))))
 
 (define html-comment
   (sequence* ((_ (char-seq "<!--"))
-              (text (->> item
-                         (preceded-by (none-of (char-seq "-->")))
+              (text (->> (none-of* (char-seq "-->") item)
                          (zero-or-more)
                          (as-string)))
               (_ (char-seq "-->")))
    (html-element-parser
     (list (char-seq "a") (char-seq "span"))
     (lambda (_ close)
-      (->> (preceded-by (none-of close) inline)
+      (->> (none-of* close inline)
            (zero-or-more))))))
 
 (define raw-html
           (as-string special-char)))
 
 (define inline-without-line-end
-  (preceded-by (none-of line-end) inline))
+  (none-of* line-end inline))
 
 (define inlines
   (one-or-more
                             (is closing-delimiter)
                             space*
                             (any-of new-line end-of-input))
-                           (none-of new-line)
-                           (preceded-by item)
+                           (none-of* new-line item)
                            (zero-or-more)
                            (as-string)))
                 (_ (is closing-delimiter)))
                         (title ,title)))))
 
 (define raw-line
-  (any-of (-> (none-of (is #\return) (is #\newline))
-              (preceded-by item)
+  (any-of (-> (is #\return #\newline)
+              (none-of* item)
               (zero-or-more)
               (sequence new-line))
           (sequence (one-or-more item) end-of-input)))
   (preceded-by indent line))
 
 (define non-blank-indented-line
-  (preceded-by (none-of blank-line) indented-line))
+  (none-of* blank-line indented-line))
 
 (define optionally-indented-line
   (preceded-by (maybe indent) line))
   (any-of bullet enumerator))
 
 (define list-block-line
-  (preceded-by (none-of blank-line
-                        (preceded-by (maybe indent) list-item-start)
-                        horizontal-rule)
-               optionally-indented-line))
+  (none-of* blank-line
+            (preceded-by (maybe indent) list-item-start)
+            horizontal-rule
+            optionally-indented-line))
 
 (define list-block
-  (sequence (preceded-by (none-of blank-line) line)
+  (sequence (none-of* blank-line line)
             (zero-or-more list-block-line)))
 
 (define list-continuation-block
    (sequence* ((_ list-item-start)
                (first-block (as-string list-block))
                (more-blocks (->> list-continuation-block
-                                 (preceded-by (none-of blank-line))
+                                 (none-of* blank-line)
                                  (zero-or-more)
                                  (as-string)))
                (_ (none-of list-continuation-block)))
   (list* enumerator 'ordered-list))
 
 (define atx-inline
-  (-> (none-of new-line (sequence space* (zero-or-more (is #\#)) space* new-line))
-      (preceded-by inline)))
+  (none-of* new-line
+            (sequence space* (zero-or-more (is #\#)) space* new-line)
+            inline))
 
 (define atx-start
   (sequence* ((level (repeated (is #\#) min: 1 max: 6)))
 
 (define (setext-heading* level bottom-char)
   (let ((bottom (setext-bottom bottom-char)))
-    (sequence* ((text (-> (preceded-by (none-of line-end) inline)
+    (sequence* ((text (-> (none-of* line-end inline)
                           (one-or-more)
                           (as-string)))
                 (_ (preceded-by space* new-line bottom)))
   (sequence*
       ((text (->> (sequence
                     (preceded-by (is #\>) (maybe (is #\space)) line)
-                    (zero-or-more (preceded-by (none-of (is #\>) blank-line) line))
+                    (zero-or-more (none-of* (is #\>) blank-line line))
                     (zero-or-more blank-line))
                   (one-or-more)
                   (as-string))))
    element-parser
    (lambda (el close)
      (let ((element (html-block-in-tags* (char-seq el))))
-       (->> (preceded-by (none-of close) item)
+       (->> (none-of* close item)
             (any-of element)
             (zero-or-more))))))