From cd21f6d9873f77b808ee55feca8062abe909532e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Thu, 3 Nov 2022 03:36:58 -0300 Subject: Adapt to using empty values in comp Also changed some names to make them more parser-y. --- json.lisp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'json.lisp') diff --git a/json.lisp b/json.lisp index 9c17bc8..94f04ee 100644 --- a/json.lisp +++ b/json.lisp @@ -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)) -- cgit v1.2.3