PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/unmaintained/multi-method-syntax/multi-method-syntax.factor

http://github.com/abeaumont/factor
Unknown | 23 lines | 14 code | 9 blank | 0 comment | 0 complexity | a2a85710f6e7862fbe58e05ee180b0be MD5 | raw file
 1
 2USING: accessors effects.parser kernel lexer multi-methods
 3       parser sequences words ;
 4
 5IN: multi-method-syntax
 6
 7! A nicer specializer syntax to hold us over till multi-methods go in
 8! officially.
 9!
10! Use both 'multi-methods' and 'multi-method-syntax' in that order.
11
12: scan-specializer ( -- specializer )
13
14  scan drop ! eat opening parenthesis
15
16  ")" parse-effect in>> [ search ] map ;
17
18: CREATE-METHOD ( -- method )
19  scan-word scan-specializer swap create-method-in ;
20
21: (METHOD:) ( -- method def ) CREATE-METHOD parse-definition ;
22
23: METHOD: (METHOD:) define ; parsing