3 (defparameter *keywords
*
4 '("attribute" "default" "datatypes" "div" "element" "empty" "external"
5 "grammar" "include" "inherit" "list" "mixed" "namespace" "notAllowed"
6 "parent" "start" "string" "text" "token"
8 "=" "{" "}" "," "&" "|" "?" "*" "+" "(" ")" "|=" "&=" ":" ":*" "~"))
18 (range #.
(code-char 35) #.
(code-char 38))
19 (range #.
(code-char 40) #.
(code-char #xd7ff
))
20 (range #.
(code-char #xe000
) #.
(code-char #xfffd
))
21 (range #.
(code-char #x10000
) #.
(code-char #x10ffff
))))
22 (string-char (or normal-char space
))
24 (or #.
(code-char 34) #.
(code-char 39) normal-char
))
28 (or #.
(code-char 10) #.
(code-char 13))))
31 (#\
# (clex:begin
'comment
))
32 ((clex::in comment newline
) (clex:begin
'clex
:initial
))
33 ((clex::in comment char
))
35 ((and "'''" (* (or string-char
#\")) "'''")
36 (return (subseq clex
:bag
3 (- (length clex
:bag
) 3))))
38 ((and #\' (* (or string-char
#\")) #\')
39 (when (or (find (code-char 13) clex
:bag
)
40 (find (code-char 10) clex
:bag
))
41 (rng-error "disallowed newline in string literal"))
43 (subseq clex
:bag
1 (- (length clex
:bag
) 1))))
45 ((and #\" #\" #\" (* (or string-char
#\")) #\" #\" #\")
46 (return (subseq clex
:bag
3 (- (length clex
:bag
) 3))))
48 ((and #\" (* (or string-char
#\')) #\")
49 (when (or (find (code-char 13) clex
:bag
)
50 (find (code-char 10) clex
:bag
))
51 (rng-error "disallowed newline in string literal"))
53 (subseq clex
:bag
1 (- (length clex
:bag
) 1))))
57 (if (find clex
:bag
*keywords
* :test
#'equal
)
58 (intern (string-upcase clex
:bag
) :keyword
)
61 (defun compact (&optional
(p #"/home/david/src/lisp/cxml-rng/test.rnc"))
64 (let ((f (make-test-lexer s
)))
69 (with-input-from-string (s p
)
70 (let ((f (make-test-lexer s
)))