words: Change word -> last-word, set-word -> set-last-word.
parent
5a1692eead
commit
5fab749dcc
|
@ -61,7 +61,7 @@ ERROR: *-in-c-type-name name ;
|
|||
: (CREATE-C-TYPE) ( word -- word )
|
||||
validate-c-type-name current-vocab create {
|
||||
[ fake-definition ]
|
||||
[ set-word ]
|
||||
[ set-last-word ]
|
||||
[ reset-c-type ]
|
||||
[ ]
|
||||
} cleave ;
|
||||
|
|
|
@ -566,7 +566,7 @@ M: quotation '
|
|||
fixup-header
|
||||
"Image length: " write image get length .
|
||||
"Object cache size: " write objects get assoc-size .
|
||||
\ word global delete-at
|
||||
\ last-word-symbol global delete-at
|
||||
image get ;
|
||||
|
||||
! Image output
|
||||
|
|
|
@ -25,13 +25,13 @@ SYNTAX: FUNCTOR-SYNTAX:
|
|||
: scan-c-type-param ( -- c-type/param )
|
||||
scan-token dup "{" = [ drop \ } parse-until >array ] [ >string-param ] if ;
|
||||
|
||||
: define* ( word def -- ) over set-word define ;
|
||||
: define* ( word def -- ) over set-last-word define ;
|
||||
|
||||
: define-declared* ( word def effect -- )
|
||||
pick set-word define-declared ;
|
||||
pick set-last-word define-declared ;
|
||||
|
||||
: define-simple-generic* ( word effect -- )
|
||||
over set-word define-simple-generic ;
|
||||
over set-last-word define-simple-generic ;
|
||||
|
||||
: define-tuple-class* ( class superclass slots -- )
|
||||
pick set-word define-tuple-class ;
|
||||
pick set-last-word define-tuple-class ;
|
||||
|
|
|
@ -64,7 +64,7 @@ FUNCTOR-SYNTAX: TUPLE:
|
|||
\ define-tuple-class* suffix! ;
|
||||
|
||||
FUNCTOR-SYNTAX: final
|
||||
[ word make-final ] append! ;
|
||||
[ last-word make-final ] append! ;
|
||||
|
||||
FUNCTOR-SYNTAX: SINGLETON:
|
||||
scan-param suffix!
|
||||
|
@ -117,7 +117,7 @@ FUNCTOR-SYNTAX: MACRO:
|
|||
parse-declared*
|
||||
\ define-macro suffix! ;
|
||||
|
||||
FUNCTOR-SYNTAX: inline [ word make-inline ] append! ;
|
||||
FUNCTOR-SYNTAX: inline [ last-word make-inline ] append! ;
|
||||
|
||||
FUNCTOR-SYNTAX: call-next-method T{ fake-call-next-method } suffix! ;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ PRIVATE>
|
|||
: define-typed ( word def effect -- )
|
||||
[ [ 2drop ] [ typed-def ] [ 2nip ] 3tri define-inline ]
|
||||
[ drop "typed-def" set-word-prop ]
|
||||
[ 2drop "typed-word" word-prop \ word set-global ] 3tri ;
|
||||
[ 2drop "typed-word" word-prop set-last-word ] 3tri ;
|
||||
|
||||
SYNTAX: TYPED:
|
||||
(:) define-typed ;
|
||||
|
|
|
@ -9,7 +9,7 @@ IN: classes.parser
|
|||
: create-class-in ( string -- word )
|
||||
current-vocab create
|
||||
dup t "defining-class" set-word-prop
|
||||
dup set-word
|
||||
dup set-last-word
|
||||
dup save-class-location
|
||||
dup create-predicate-word save-location ;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ ERROR: not-in-a-method-error ;
|
|||
[ scan-new-generic ] dip call scan-effect define-generic ; inline
|
||||
|
||||
: create-method-in ( class generic -- method )
|
||||
create-method dup set-word dup save-location ;
|
||||
create-method dup set-last-word dup save-location ;
|
||||
|
||||
: define-inline-method ( class generic quot -- )
|
||||
[ create-method-in ] dip [ define ] [ drop make-inline ] 2bi ;
|
||||
|
@ -38,7 +38,7 @@ SYMBOL: current-method
|
|||
ERROR: bad-method-effect ;
|
||||
|
||||
: check-method-effect ( effect -- )
|
||||
word generic-effect method-effect= [ bad-method-effect ] unless ;
|
||||
last-word generic-effect method-effect= [ bad-method-effect ] unless ;
|
||||
|
||||
: ?execute-parsing ( word/number -- seq )
|
||||
dup parsing-word?
|
||||
|
|
|
@ -18,7 +18,7 @@ IN: parser
|
|||
M: parsing-word stack-effect drop ( parsed -- parsed ) ;
|
||||
|
||||
: create-in ( str -- word )
|
||||
current-vocab create dup set-word dup save-location ;
|
||||
current-vocab create dup set-last-word dup save-location ;
|
||||
|
||||
SYMBOL: auto-use?
|
||||
|
||||
|
|
|
@ -105,12 +105,12 @@ IN: bootstrap.syntax
|
|||
"POSTPONE:" [ scan-word suffix! ] define-core-syntax
|
||||
"\\" [ scan-word <wrapper> suffix! ] define-core-syntax
|
||||
"M\\" [ scan-word scan-word lookup-method <wrapper> suffix! ] define-core-syntax
|
||||
"inline" [ word make-inline ] define-core-syntax
|
||||
"recursive" [ word make-recursive ] define-core-syntax
|
||||
"foldable" [ word make-foldable ] define-core-syntax
|
||||
"flushable" [ word make-flushable ] define-core-syntax
|
||||
"delimiter" [ word t "delimiter" set-word-prop ] define-core-syntax
|
||||
"deprecated" [ word make-deprecated ] define-core-syntax
|
||||
"inline" [ last-word make-inline ] define-core-syntax
|
||||
"recursive" [ last-word make-recursive ] define-core-syntax
|
||||
"foldable" [ last-word make-foldable ] define-core-syntax
|
||||
"flushable" [ last-word make-flushable ] define-core-syntax
|
||||
"delimiter" [ last-word t "delimiter" set-word-prop ] define-core-syntax
|
||||
"deprecated" [ last-word make-deprecated ] define-core-syntax
|
||||
|
||||
"SYNTAX:" [
|
||||
scan-new-word parse-definition define-syntax
|
||||
|
@ -136,7 +136,7 @@ IN: bootstrap.syntax
|
|||
|
||||
"DEFER:" [
|
||||
scan-token current-vocab create
|
||||
[ fake-definition ] [ set-word ] [ undefined-def define ] tri
|
||||
[ fake-definition ] [ set-last-word ] [ undefined-def define ] tri
|
||||
] define-core-syntax
|
||||
|
||||
"ALIAS:" [
|
||||
|
@ -206,7 +206,7 @@ IN: bootstrap.syntax
|
|||
] define-core-syntax
|
||||
|
||||
"final" [
|
||||
word make-final
|
||||
last-word make-final
|
||||
] define-core-syntax
|
||||
|
||||
"SLOT:" [
|
||||
|
|
|
@ -268,14 +268,14 @@ HELP: gensym
|
|||
HELP: bootstrapping?
|
||||
{ $var-description "Set by the library while bootstrap is in progress. Some parsing words need to behave differently during bootstrap." } ;
|
||||
|
||||
HELP: word
|
||||
HELP: last-word
|
||||
{ $values { "word" word } }
|
||||
{ $description "Outputs the most recently defined word." }
|
||||
{ $class-description "The class of words. One notable subclass is " { $link class } ", the class of class words." } ;
|
||||
|
||||
{ word set-word save-location } related-words
|
||||
{ last-word set-last-word save-location } related-words
|
||||
|
||||
HELP: set-word
|
||||
HELP: set-last-word
|
||||
{ $values { "word" word } }
|
||||
{ $description "Sets the recently defined word." } ;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ DEFER: deferred
|
|||
[ f ] [ "no-loc-2" "words.tests" lookup-word where ] unit-test
|
||||
|
||||
[ ] [ "IN: words.tests : test-last ( -- ) ;" eval( -- ) ] unit-test
|
||||
[ "test-last" ] [ word name>> ] unit-test
|
||||
[ "test-last" ] [ last-word name>> ] unit-test
|
||||
|
||||
"undef-test" "words.tests" lookup-word [
|
||||
[ forget ] with-compilation-unit
|
||||
|
|
|
@ -11,9 +11,16 @@ BUILTIN: word
|
|||
{ def quotation initial: [ ] } props pic-def pic-tail-def
|
||||
{ sub-primitive read-only } ;
|
||||
|
||||
: word ( -- word ) \ word get-global ;
|
||||
! Need a dummy word here because BUILTIN: word is not a real word
|
||||
! and parse-datum looks for things that are actually words instead of
|
||||
! also looking for classes
|
||||
: word ( -- * ) "dummy word" throw ;
|
||||
|
||||
: set-word ( word -- ) \ word set-global ;
|
||||
SYMBOL: last-word-symbol
|
||||
|
||||
: last-word ( -- word ) \ last-word-symbol get-global ;
|
||||
|
||||
: set-last-word ( word -- ) \ last-word-symbol set-global ;
|
||||
|
||||
M: word execute (execute) ;
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ SYNTAX: GENERIC: scan-new-word scan-effect define-generic ;
|
|||
parse-definition [ 2 tail ] [ second ] [ first ] tri ;
|
||||
|
||||
: create-method-in ( specializer generic -- method )
|
||||
create-method dup save-location f set-word ;
|
||||
create-method dup save-location f set-last-word ;
|
||||
|
||||
: scan-new-method ( -- method )
|
||||
scan-word scan-object swap create-method-in ;
|
||||
|
|
Loading…
Reference in New Issue