effects.parser: throw a proper no-word error if effect references an unknown class word
parent
050d042449
commit
f0aa694c7e
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2007, 2010 Slava Pestov.
|
! Copyright (C) 2007, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: parser kernel sequences words effects combinators assocs
|
USING: parser effects.parser kernel sequences words effects
|
||||||
definitions quotations namespaces memoize accessors fry
|
combinators assocs definitions quotations namespaces memoize
|
||||||
compiler.units ;
|
accessors fry compiler.units ;
|
||||||
IN: macros
|
IN: macros
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
|
@ -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.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel hashtables sequences sequences.private arrays
|
USING: kernel hashtables sequences sequences.private arrays
|
||||||
words namespaces make parser math assocs effects definitions
|
words namespaces make parser effects.parser math assocs effects
|
||||||
quotations summary accessors fry ;
|
definitions quotations summary accessors fry ;
|
||||||
IN: memoize
|
IN: memoize
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
! Copyright (C) 2007, 2008 Chris Double.
|
! Copyright (C) 2007, 2008 Chris Double.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel sequences strings fry namespaces make math assocs
|
USING: kernel sequences strings fry namespaces make math assocs
|
||||||
io vectors arrays math.parser math.order combinators
|
io vectors arrays math.parser math.order combinators classes
|
||||||
classes sets unicode.categories compiler.units parser words
|
sets unicode.categories compiler.units parser effects.parser
|
||||||
quotations memoize accessors locals splitting
|
words quotations memoize accessors locals splitting
|
||||||
combinators.short-circuit generalizations ;
|
combinators.short-circuit generalizations ;
|
||||||
IN: peg
|
IN: peg
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2004, 2006 Chris Double, Matthew Willis.
|
! Copyright (C) 2004, 2006 Chris Double, Matthew Willis.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays effects fry generalizations kernel math
|
USING: accessors arrays effects fry generalizations kernel math
|
||||||
namespaces parser sequences words ;
|
namespaces parser effects.parser sequences words ;
|
||||||
IN: promises
|
IN: promises
|
||||||
|
|
||||||
TUPLE: promise quot forced? value ;
|
TUPLE: promise quot forced? value ;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
USING: accessors arrays classes classes.tuple combinators
|
USING: accessors arrays classes classes.tuple combinators
|
||||||
combinators.short-circuit definitions effects fry hints
|
combinators.short-circuit definitions effects fry hints
|
||||||
math kernel kernel.private namespaces parser quotations
|
math kernel kernel.private namespaces parser quotations
|
||||||
sequences slots words locals
|
sequences slots words locals effects.parser
|
||||||
locals.parser macros stack-checker.dependencies ;
|
locals.parser macros stack-checker.dependencies ;
|
||||||
FROM: classes.tuple.private => tuple-layout ;
|
FROM: classes.tuple.private => tuple-layout ;
|
||||||
IN: typed
|
IN: typed
|
||||||
|
|
|
@ -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.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: lexer sets sequences kernel splitting effects
|
USING: lexer sets sequences kernel splitting effects
|
||||||
combinators arrays vocabs.parser classes ;
|
combinators arrays vocabs.parser classes parser ;
|
||||||
IN: effects.parser
|
IN: effects.parser
|
||||||
|
|
||||||
DEFER: parse-effect
|
DEFER: parse-effect
|
||||||
|
@ -14,9 +14,8 @@ ERROR: bad-effect ;
|
||||||
":" ?tail [
|
":" ?tail [
|
||||||
scan {
|
scan {
|
||||||
{ [ dup "(" = ] [ drop ")" parse-effect ] }
|
{ [ dup "(" = ] [ drop ")" parse-effect ] }
|
||||||
{ [ dup search class? ] [ search ] }
|
|
||||||
{ [ dup f = ] [ ")" unexpected-eof ] }
|
{ [ dup f = ] [ ")" unexpected-eof ] }
|
||||||
[ bad-effect ]
|
[ parse-word dup class? [ bad-effect ] unless ]
|
||||||
} cond 2array
|
} cond 2array
|
||||||
] when
|
] when
|
||||||
] if
|
] if
|
||||||
|
@ -36,3 +35,8 @@ ERROR: stack-effect-omits-dashes tokens ;
|
||||||
|
|
||||||
: parse-call( ( accum word -- accum )
|
: parse-call( ( accum word -- accum )
|
||||||
[ ")" parse-effect ] dip 2array append! ;
|
[ ")" parse-effect ] dip 2array append! ;
|
||||||
|
|
||||||
|
: (:) ( -- word def effect )
|
||||||
|
CREATE-WORD
|
||||||
|
complete-effect
|
||||||
|
parse-definition swap ;
|
||||||
|
|
|
@ -5,7 +5,7 @@ sequences strings vectors words words.symbol quotations io
|
||||||
combinators sorting splitting math.parser effects continuations
|
combinators sorting splitting math.parser effects continuations
|
||||||
io.files vocabs io.encodings.utf8 source-files classes
|
io.files vocabs io.encodings.utf8 source-files classes
|
||||||
hashtables compiler.units accessors sets lexer vocabs.parser
|
hashtables compiler.units accessors sets lexer vocabs.parser
|
||||||
effects.parser slots parser.notes ;
|
slots parser.notes ;
|
||||||
IN: parser
|
IN: parser
|
||||||
|
|
||||||
: location ( -- loc )
|
: location ( -- loc )
|
||||||
|
@ -102,11 +102,6 @@ M: f parse-quotation \ ] parse-until >quotation ;
|
||||||
: parse-definition ( -- quot )
|
: parse-definition ( -- quot )
|
||||||
\ ; parse-until >quotation ;
|
\ ; parse-until >quotation ;
|
||||||
|
|
||||||
: (:) ( -- word def effect )
|
|
||||||
CREATE-WORD
|
|
||||||
complete-effect
|
|
||||||
parse-definition swap ;
|
|
||||||
|
|
||||||
ERROR: bad-number ;
|
ERROR: bad-number ;
|
||||||
|
|
||||||
: scan-base ( base -- n )
|
: scan-base ( base -- n )
|
||||||
|
|
Loading…
Reference in New Issue