diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-01-05 16:55:51 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-01-05 17:11:20 +0100 |
commit | 5b518ad7205b3432d95ff2b3757e49914233d913 (patch) | |
tree | c4abb63c32cc1821a1f072a9e6487d067a873bc3 /src/parser.lisp | |
parent | bc69faaa5bbd8a2d8afb9ab81882b1ba21c4bb8e (diff) |
Clean up eval-tree
Diffstat (limited to 'src/parser.lisp')
-rw-r--r-- | src/parser.lisp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/parser.lisp b/src/parser.lisp index f0821fc..2d3c673 100644 --- a/src/parser.lisp +++ b/src/parser.lisp @@ -1,11 +1,14 @@ (in-package #:chains) -(defconstant +special-characters+ - '(#\\ #\% #\@ #\$ #\{ #\} #\[ #\] #\Newline) - "") +(define-constant +special-characters+ + '(#\\ #\% #\@ #\$ #\{ #\} #\[ #\] #\Newline) + :test #'equal + :documentation "") -(defconstant +whitespace+ '(#\Tab #\Newline #\Return #\Space) - "") +(define-constant +whitespace+ + '(#\Tab #\Newline #\Return #\Space) + :test #'equal + :documentation "") ;; TODO: (read-char stream nil) (defun read-if (predicate stream) @@ -101,7 +104,7 @@ tokens." (multiple-value-bind (tree rest) (build-tree tail) (values tree rest))) ;; @a{...} <-> {@a}{...} - ((and (object-symbolp head) + ((and (object-symbol-p head) (eq (first tail) 'link-start)) (multiple-value-bind (links rest) (build-chain (rest tail)) (multiple-value-bind (tree rest) (build-tree rest) @@ -133,7 +136,7 @@ tokens." (and (textp last-token) (newlinep (last-elt (content last-token)))))) -(defun read-tree (stream) +(defun read-tokens (stream) "Build a syntax tree from the contents of STREAM" (loop :with start-of-line = t :for token = (next-token stream start-of-line) |