guicho271828 / trivia

Pattern Matcher Compatible with Optima
Other
334 stars 22 forks source link

Fix incompatibilities between CL spec and lambda-list pattern #32

Closed ghost closed 8 years ago

ghost commented 8 years ago

There are certain incompatibilities between the CL spec for lambda-lists and parse-lambda-list, compile-destructuring-pattern.

This patch fixes cases such as,

;;matches (list 1 2 3)
M> (pattern-expand-1 `(lambda-list 1 2))
(LIST* 1 2 TRIVIA.LEVEL2.IMPL::_)
;;&rest can't appear before &optional
M> (pattern-expand-1 `(lambda-list a &rest b &optional c))
(LIST* A (AND B TRIVIA.LEVEL2.IMPL::_))
;;invalid pattern
M> (pattern-expand-1 `(lambda-list a &aux (c 2) &rest d))
(LIST* A (GUARD1 #:G835 T 2 C))
guicho271828 commented 8 years ago

Looks neat, thanks!

ghost commented 8 years ago

Sorry, I couldn't get to the tests before you.

guicho271828 commented 8 years ago

no problem!