Fixing bug with quoted expressions for lisp.parser

db4
James Cash 2008-09-14 20:23:40 -04:00
parent 6899bb2898
commit f82cb061f5
2 changed files with 6 additions and 2 deletions

View File

@ -73,4 +73,8 @@ IN: lisp.parser.tests
{ { T{ lisp-symbol f "quote" } T{ lisp-symbol f "foo" } } } [
"'foo" lisp-expr cons>seq
] unit-test
{ { 1 2 { T{ lisp-symbol { name "quote" } } { 3 4 } } 5 } } [
"(1 2 '(3 4) 5)" lisp-expr cons>seq
] unit-test

View File

@ -35,7 +35,7 @@ atom = number
| identifier
| string
s-expression = LPAREN (list-item)* RPAREN => [[ second seq>cons ]]
list-item = _ ( atom | s-expression ) _ => [[ second ]]
list-item = _ ( atom | s-expression | quoted ) _ => [[ second ]]
quoted = squote list-item => [[ second nil cons "quote" <lisp-symbol> swap cons ]]
expr = list-item | quoted
expr = list-item
;EBNF