1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: lexer sets sequences kernel splitting effects
4 combinators arrays parser ;
11 : parse-effect-token ( end -- token/f )
12 scan [ nip ] [ = ] 2bi [ drop f ] [
13 dup { f "(" "((" } member? [ bad-effect ] [
16 { \ ( [ ")" parse-effect ] }
23 : parse-effect-tokens ( end -- tokens )
24 [ parse-effect-token dup ] curry [ ] [ drop ] produce ;
26 : parse-effect ( end -- effect )
27 parse-effect-tokens { "--" } split1 dup
28 [ <effect> ] [ "Stack effect declaration must contain --" throw ] if ;