Refactor sp peg parser

db4
Chris Double 2008-04-05 18:36:17 +13:00
parent d93c7958fd
commit 2744313ac1
1 changed files with 4 additions and 5 deletions

View File

@ -431,8 +431,7 @@ MATCH-VARS: ?action ;
] if ; inline ] if ; inline
M: action-parser (compile) ( parser -- quot ) M: action-parser (compile) ( parser -- quot )
[ p1>> compiled-parser 1quotation ] [ quot>> ] bi '[ [ p1>> compiled-parser 1quotation ] [ quot>> ] bi '[ @ , check-action ] ;
@ , check-action ] ;
: left-trim-slice ( string -- string ) : left-trim-slice ( string -- string )
#! Return a new string without any leading whitespace #! Return a new string without any leading whitespace
@ -444,9 +443,9 @@ M: action-parser (compile) ( parser -- quot )
TUPLE: sp-parser p1 ; TUPLE: sp-parser p1 ;
M: sp-parser (compile) ( parser -- quot ) M: sp-parser (compile) ( parser -- quot )
[ p1>> compiled-parser 1quotation '[
\ input-slice , \ left-trim-slice , \ input-from , \ pos , \ set , p1>> compiled-parser , input-slice left-trim-slice input-from pos set @
] [ ] make ; ] ;
TUPLE: delay-parser quot ; TUPLE: delay-parser quot ;