lists: check for errors like L{ . 3 }.
parent
20f0b8aa28
commit
08dd854b15
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 James Cash, Daniel Ehrenberg, Chris Double.
|
! Copyright (C) 2008 James Cash, Daniel Ehrenberg, Chris Double.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors combinators combinators.short-circuit kernel
|
USING: accessors combinators combinators.short-circuit kernel
|
||||||
lexer locals make math parser sequences words ;
|
lexer locals make math namespaces parser sequences words ;
|
||||||
IN: lists
|
IN: lists
|
||||||
|
|
||||||
! List Protocol
|
! List Protocol
|
||||||
|
@ -114,10 +114,13 @@ ERROR: list-syntax-error ;
|
||||||
<reversed> unclip-slice [ swons ] reduce
|
<reversed> unclip-slice [ swons ] reduce
|
||||||
] if-empty ;
|
] if-empty ;
|
||||||
|
|
||||||
|
: ?list-syntax-error ( right-of-dot? -- )
|
||||||
|
building get empty? or [ list-syntax-error ] when ;
|
||||||
|
|
||||||
: (parse-list-literal) ( right-of-dot? -- )
|
: (parse-list-literal) ( right-of-dot? -- )
|
||||||
scan-token {
|
scan-token {
|
||||||
{ "}" [ drop +nil+ , ] }
|
{ "}" [ drop +nil+ , ] }
|
||||||
{ "." [ [ list-syntax-error ] when t (parse-list-literal) ] }
|
{ "." [ ?list-syntax-error t (parse-list-literal) ] }
|
||||||
[
|
[
|
||||||
parse-datum dup parsing-word? [
|
parse-datum dup parsing-word? [
|
||||||
V{ } clone swap execute-parsing first
|
V{ } clone swap execute-parsing first
|
||||||
|
|
Loading…
Reference in New Issue