- ;; Return (VALUE-KIND . VALUE-FORM), ready for passing to a
- ;; `sod-initializer' constructor.
-
- ;; This is kind of tricky because we have to juggle both
- ;; layers of the parsing machinery. The character scanner
- ;; will already have consumed the lookahead token (which, if
- ;; we're going to do anything, is `=').
- (let ((char-scanner (token-scanner-char-scanner scanner)))
-
- ;; First, skip the character-scanner past any whitespace.
- ;; We don't record this consumption, which is a bit
- ;; naughty, but nobody will actually mind.
- (loop
- (when (or (scanner-at-eof-p char-scanner)
- (not (whitespace-char-p
- (scanner-current-char char-scanner))))
- (return))
- (scanner-step char-scanner))
-
- ;; Now maybe read an initializer.
- (cond ((not (eql (token-type scanner) #\=))
- ;; It's not an `=' after all. There's no
- ;; initializer.
- (values '(#\=) nil nil))
-
- ((and (not (scanner-at-eof-p char-scanner))
- (char= (scanner-current-char char-scanner)
- #\{))
- ;; There's a brace after the `=', so we should
- ;; consume the `=' here, and read a compound
- ;; initializer enclosed in braces.
- (parse (seq (#\= (frag (parse-delimited-fragment
- scanner #\{ #\})))
- (cons :compound frag))))
-
- (t
- ;; No brace, so read from the `=' up to, but not
- ;; including, the trailing `,' or `;' delimiter.
- (parse (seq ((frag (parse-delimited-fragment
- scanner #\= '(#\; #\,)
- :keep-end t)))
- (cons :simple frag)))))))