[ 4 ] [ 1 3 blah ] unit-test
+<<
+
+FUNCTOR: symbol-test ( W -- )
+
+W DEFINES ${W}
+
+WHERE
+
+SYMBOL: W
+
+;FUNCTOR
+
+"blorgh" symbol-test
+
+>>
+
+[ blorgh ] [ blorgh ] unit-test
+
GENERIC: some-generic ( a -- b )
! Does replacing an ordinary word with a functor-generated one work?
TUPLE: some-tuple ;
: some-word ( -- ) ;
M: some-tuple some-generic ;
+ SYMBOL: some-symbol
"> <string-reader> "functors-test" parse-stream
] unit-test
"some-tuple" "functors.tests" lookup
"some-generic" "functors.tests" lookup method >boolean
] unit-test ;
+ [ t ] [ "some-symbol" "functors.tests" lookup >boolean ] unit-test
test-redefinition
W-word DEFINES ${W}-word
W-tuple DEFINES-CLASS ${W}-tuple
W-generic IS ${W}-generic
+W-symbol DEFINES ${W}-symbol
WHERE
TUPLE: W-tuple ;
: W-word ( -- ) ;
M: W-tuple W-generic ;
+SYMBOL: W-symbol
;FUNCTOR
"> <string-reader> "functors-test" parse-stream
] unit-test
-test-redefinition
\ No newline at end of file
+test-redefinition
+
classes.mixin effects lexer parser classes.tuple.parser
effects.parser locals.types locals.parser generic.parser
locals.rewrite.closures vocabs.parser classes.parser
-arrays accessors ;
+arrays accessors words.symbol ;
IN: functors
! This is a hack
parse-declared*
\ define-declared* parsed ;
+SYNTAX: `SYMBOL:
+ scan-param parsed
+ \ define-symbol parsed ;
+
SYNTAX: `SYNTAX:
scan-param parsed
parse-definition*
{ ":" POSTPONE: `: }
{ "INSTANCE:" POSTPONE: `INSTANCE: }
{ "SYNTAX:" POSTPONE: `SYNTAX: }
+ { "SYMBOL:" POSTPONE: `SYMBOL: }
{ "inline" POSTPONE: `inline }
} ;