factor/core/generic/parser/parser.factor

24 lines
654 B
Factor
Raw Normal View History

2008-06-25 04:25:08 -04:00
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
2008-07-28 23:03:13 -04:00
USING: parser kernel words generic namespaces ;
2008-06-25 04:25:08 -04:00
IN: generic.parser
ERROR: not-in-a-method-error ;
: CREATE-GENERIC ( -- word ) CREATE dup reset-word ;
: create-method-in ( class generic -- method )
create-method dup set-word dup save-location ;
2008-06-25 04:25:08 -04:00
: CREATE-METHOD ( -- method )
scan-word bootstrap-word scan-word create-method-in ;
SYMBOL: current-method
: with-method-definition ( method quot -- )
over current-method set call current-method off ; inline
2008-06-25 04:25:08 -04:00
2009-03-16 07:17:18 -04:00
: (M:) ( -- method def )
2008-06-25 04:25:08 -04:00
CREATE-METHOD [ parse-definition ] with-method-definition ;