diff options
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) |