lists: check for errors like L{ . 3 }.

master
John Benediktsson 2020-02-24 09:11:46 -08:00
parent 20f0b8aa28
commit 08dd854b15
1 changed files with 5 additions and 2 deletions

View File

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