diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-11-03 03:36:58 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-11-03 03:36:58 -0300 |
commit | cd21f6d9873f77b808ee55feca8062abe909532e (patch) | |
tree | 5f4d516795a9366c37a5a0b898754d492ad0744a | |
parent | 112f9dd2a59663b93fd5c4c960f2104e9c2b9418 (diff) | |
download | json-cd21f6d9873f77b808ee55feca8062abe909532e.tar.gz json-cd21f6d9873f77b808ee55feca8062abe909532e.zip |
Adapt to using empty values in comp
Also changed some names to make them more parser-y.
-rw-r--r-- | json.lisp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,6 +1,6 @@ (in-package #:json) -(defparameter number-parser +(defparameter number-literal (let ((signed-digits (comp ((sign (zero-or-one (unit (lambda (x) (or (char= x #\-) (char= x #\+)))))) @@ -21,8 +21,8 @@ nothing))) (list 'number base fraction exponent)))) -(defparameter string-parser - (comp ((start (unit (lambda (x) (char= x #\")))) +(defparameter string-literal + (comp ((_ (unit (lambda (x) (char= x #\")))) (chars (zero-or-more (either (comp ((slash (unit (lambda (x) (char= x #\\)))) (escaped (unit)) (codepoints (if (and escaped (char= escaped #\u)) @@ -46,11 +46,11 @@ codepoints) (t escaped))) (unit (lambda (x) (char/= x #\")))))) - (end (unit (lambda (x) (char= x #\"))))) + (_ (unit (lambda (x) (char= x #\"))))) (list 'string chars))) -(defparameter whitespace-parser - (comp ((whitespace (zero-or-more (unit (lambda (x) (or (char= x #\Space) - (char= x #\Newline) - (char= x #\Tab))))))) +(defparameter whitespace + (comp ((_ (zero-or-more (unit (lambda (x) (or (char= x #\Space) + (char= x #\Newline) + (char= x #\Tab))))))) nil)) |