Don't need MEMO: there anymore according to doublec

db4
Slava Pestov 2008-06-04 19:33:43 -05:00
parent 7cc553c4b6
commit ab5843d831
1 changed files with 7 additions and 8 deletions

View File

@ -1,7 +1,6 @@
! Copyright (C) 2008 Slava Pestov ! Copyright (C) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: peg peg.parsers kernel sequences strings words USING: peg peg.parsers kernel sequences strings words ;
memoize ;
IN: io.unix.launcher.parser IN: io.unix.launcher.parser
! Our command line parser. Supported syntax: ! Our command line parser. Supported syntax:
@ -9,20 +8,20 @@ IN: io.unix.launcher.parser
! foo\ bar -- escaping the space ! foo\ bar -- escaping the space
! 'foo bar' -- quotation ! 'foo bar' -- quotation
! "foo bar" -- quotation ! "foo bar" -- quotation
MEMO: 'escaped-char' ( -- parser ) : 'escaped-char' ( -- parser )
"\\" token [ drop t ] satisfy 2seq [ second ] action ; "\\" token any-char 2seq [ second ] action ;
MEMO: 'quoted-char' ( delimiter -- parser' ) : 'quoted-char' ( delimiter -- parser' )
'escaped-char' 'escaped-char'
swap [ member? not ] curry satisfy swap [ member? not ] curry satisfy
2choice ; inline 2choice ; inline
MEMO: 'quoted' ( delimiter -- parser ) : 'quoted' ( delimiter -- parser )
dup 'quoted-char' repeat0 swap dup surrounded-by ; dup 'quoted-char' repeat0 swap dup surrounded-by ;
MEMO: 'unquoted' ( -- parser ) " '\"" 'quoted-char' repeat1 ; : 'unquoted' ( -- parser ) " '\"" 'quoted-char' repeat1 ;
MEMO: 'argument' ( -- parser ) : 'argument' ( -- parser )
"\"" 'quoted' "\"" 'quoted'
"'" 'quoted' "'" 'quoted'
'unquoted' 3choice 'unquoted' 3choice