effects.parser: throw a proper no-word error if effect references an unknown class word

db4
Slava Pestov 2010-02-23 23:57:13 +13:00
parent 050d042449
commit f0aa694c7e
7 changed files with 20 additions and 21 deletions

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: parser kernel sequences words effects combinators assocs
definitions quotations namespaces memoize accessors fry
compiler.units ;
USING: parser effects.parser kernel sequences words effects
combinators assocs definitions quotations namespaces memoize
accessors fry compiler.units ;
IN: macros
<PRIVATE

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007, 2009 Slava Pestov, Daniel Ehrenberg.
! Copyright (C) 2007, 2010 Slava Pestov, Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel hashtables sequences sequences.private arrays
words namespaces make parser math assocs effects definitions
quotations summary accessors fry ;
words namespaces make parser effects.parser math assocs effects
definitions quotations summary accessors fry ;
IN: memoize
<PRIVATE

View File

@ -1,9 +1,9 @@
! Copyright (C) 2007, 2008 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences strings fry namespaces make math assocs
io vectors arrays math.parser math.order combinators
classes sets unicode.categories compiler.units parser words
quotations memoize accessors locals splitting
io vectors arrays math.parser math.order combinators classes
sets unicode.categories compiler.units parser effects.parser
words quotations memoize accessors locals splitting
combinators.short-circuit generalizations ;
IN: peg

View File

@ -1,7 +1,7 @@
! Copyright (C) 2004, 2006 Chris Double, Matthew Willis.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays effects fry generalizations kernel math
namespaces parser sequences words ;
namespaces parser effects.parser sequences words ;
IN: promises
TUPLE: promise quot forced? value ;

View File

@ -2,7 +2,7 @@
USING: accessors arrays classes classes.tuple combinators
combinators.short-circuit definitions effects fry hints
math kernel kernel.private namespaces parser quotations
sequences slots words locals
sequences slots words locals effects.parser
locals.parser macros stack-checker.dependencies ;
FROM: classes.tuple.private => tuple-layout ;
IN: typed

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008, 2009 Slava Pestov.
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: lexer sets sequences kernel splitting effects
combinators arrays vocabs.parser classes ;
combinators arrays vocabs.parser classes parser ;
IN: effects.parser
DEFER: parse-effect
@ -14,9 +14,8 @@ ERROR: bad-effect ;
":" ?tail [
scan {
{ [ dup "(" = ] [ drop ")" parse-effect ] }
{ [ dup search class? ] [ search ] }
{ [ dup f = ] [ ")" unexpected-eof ] }
[ bad-effect ]
[ parse-word dup class? [ bad-effect ] unless ]
} cond 2array
] when
] if
@ -36,3 +35,8 @@ ERROR: stack-effect-omits-dashes tokens ;
: parse-call( ( accum word -- accum )
[ ")" parse-effect ] dip 2array append! ;
: (:) ( -- word def effect )
CREATE-WORD
complete-effect
parse-definition swap ;

View File

@ -5,7 +5,7 @@ sequences strings vectors words words.symbol quotations io
combinators sorting splitting math.parser effects continuations
io.files vocabs io.encodings.utf8 source-files classes
hashtables compiler.units accessors sets lexer vocabs.parser
effects.parser slots parser.notes ;
slots parser.notes ;
IN: parser
: location ( -- loc )
@ -102,11 +102,6 @@ M: f parse-quotation \ ] parse-until >quotation ;
: parse-definition ( -- quot )
\ ; parse-until >quotation ;
: (:) ( -- word def effect )
CREATE-WORD
complete-effect
parse-definition swap ;
ERROR: bad-number ;
: scan-base ( base -- n )