New utility word: complete-effect
parent
0ffc9247cc
commit
e0d48e3ab6
|
@ -18,6 +18,6 @@ MACRO: set-slots ( slots -- quot )
|
||||||
|
|
||||||
SYNTAX: CONSTRUCTOR:
|
SYNTAX: CONSTRUCTOR:
|
||||||
scan-word [ name>> "<" ">" surround create-in ] keep
|
scan-word [ name>> "<" ">" surround create-in ] keep
|
||||||
"(" expect ")" parse-effect
|
complete-effect
|
||||||
parse-definition
|
parse-definition
|
||||||
define-constructor ;
|
define-constructor ;
|
|
@ -42,7 +42,7 @@ M: object fake-quotations> ;
|
||||||
parse-definition >fake-quotations parsed \ fake-quotations> parsed ;
|
parse-definition >fake-quotations parsed \ fake-quotations> parsed ;
|
||||||
|
|
||||||
: parse-declared* ( accum -- accum )
|
: parse-declared* ( accum -- accum )
|
||||||
"(" expect ")" parse-effect
|
complete-effect
|
||||||
[ parse-definition* ] dip
|
[ parse-definition* ] dip
|
||||||
parsed ;
|
parsed ;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ SYNTAX: `M:
|
||||||
SYNTAX: `C:
|
SYNTAX: `C:
|
||||||
scan-param parsed
|
scan-param parsed
|
||||||
scan-param parsed
|
scan-param parsed
|
||||||
"(" expect ")" parse-effect
|
complete-effect
|
||||||
[ [ [ boa ] curry ] over push-all ] dip parsed
|
[ [ [ boa ] curry ] over push-all ] dip parsed
|
||||||
\ define-declared* parsed ;
|
\ define-declared* parsed ;
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ M: lambda-parser parse-quotation ( -- quotation )
|
||||||
(parse-lambda) <wlet> ?rewrite-closures ;
|
(parse-lambda) <wlet> ?rewrite-closures ;
|
||||||
|
|
||||||
: parse-locals ( -- effect vars assoc )
|
: parse-locals ( -- effect vars assoc )
|
||||||
"(" expect ")" parse-effect
|
complete-effect
|
||||||
dup
|
dup
|
||||||
in>> [ dup pair? [ first ] when ] map make-locals ;
|
in>> [ dup pair? [ first ] when ] map make-locals ;
|
||||||
|
|
||||||
|
|
|
@ -27,5 +27,8 @@ ERROR: bad-effect ;
|
||||||
parse-effect-tokens { "--" } split1 dup
|
parse-effect-tokens { "--" } split1 dup
|
||||||
[ <effect> ] [ "Stack effect declaration must contain --" throw ] if ;
|
[ <effect> ] [ "Stack effect declaration must contain --" throw ] if ;
|
||||||
|
|
||||||
|
: complete-effect ( -- effect )
|
||||||
|
"(" expect ")" parse-effect ;
|
||||||
|
|
||||||
: parse-call( ( accum word -- accum )
|
: parse-call( ( accum word -- accum )
|
||||||
[ ")" parse-effect ] dip 2array over push-all ;
|
[ ")" parse-effect ] dip 2array over push-all ;
|
|
@ -134,7 +134,7 @@ M: f parse-quotation \ ] parse-until >quotation ;
|
||||||
|
|
||||||
: (:) ( -- word def effect )
|
: (:) ( -- word def effect )
|
||||||
CREATE-WORD
|
CREATE-WORD
|
||||||
"(" expect ")" parse-effect
|
complete-effect
|
||||||
parse-definition swap ;
|
parse-definition swap ;
|
||||||
|
|
||||||
ERROR: bad-number ;
|
ERROR: bad-number ;
|
||||||
|
|
Loading…
Reference in New Issue