From f82cb061f5127ec319e61980129fa1b1db6145c7 Mon Sep 17 00:00:00 2001 From: James Cash <james.nvc@gmail.com> Date: Sun, 14 Sep 2008 20:23:40 -0400 Subject: [PATCH] Fixing bug with quoted expressions for lisp.parser --- extra/lisp/parser/parser-tests.factor | 4 ++++ extra/lisp/parser/parser.factor | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extra/lisp/parser/parser-tests.factor b/extra/lisp/parser/parser-tests.factor index 68bda1780a..911a8d3440 100644 --- a/extra/lisp/parser/parser-tests.factor +++ b/extra/lisp/parser/parser-tests.factor @@ -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 \ No newline at end of file diff --git a/extra/lisp/parser/parser.factor b/extra/lisp/parser/parser.factor index 55672af13d..50f58692d5 100644 --- a/extra/lisp/parser/parser.factor +++ b/extra/lisp/parser/parser.factor @@ -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 \ No newline at end of file