1 ! Copyright (C) 2006 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel strings math sequences lists.lazy words
4 math.parser promises parser-combinators unicode.categories ;
5 IN: parser-combinators.simple
7 : 'digit' ( -- parser )
8 [ digit? ] satisfy [ digit> ] <@ ;
10 : 'integer' ( -- parser )
11 'digit' <!+> [ 10 digits>integer ] <@ ;
13 : 'string' ( -- parser )
15 [ CHAR: " = not ] satisfy <*> &>
16 [ CHAR: " = ] satisfy <& [ >string ] <@ ;
18 : 'bold' ( -- parser )
20 [ CHAR: * = not ] satisfy <*> [ >string ] <@ &>
23 : 'italic' ( -- parser )
25 [ CHAR: _ = not ] satisfy <*> [ >string ] <@ &>
28 : comma-list ( element -- parser )