From 2744313ac14679397be74f345b63b9264b53db3b Mon Sep 17 00:00:00 2001 From: Chris Double Date: Sat, 5 Apr 2008 18:36:17 +1300 Subject: [PATCH] Refactor sp peg parser --- extra/peg/peg.factor | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extra/peg/peg.factor b/extra/peg/peg.factor index fd41a67bfe..22405c9cbf 100755 --- a/extra/peg/peg.factor +++ b/extra/peg/peg.factor @@ -431,8 +431,7 @@ MATCH-VARS: ?action ; ] if ; inline M: action-parser (compile) ( parser -- quot ) - [ p1>> compiled-parser 1quotation ] [ quot>> ] bi '[ - @ , check-action ] ; + [ p1>> compiled-parser 1quotation ] [ quot>> ] bi '[ @ , check-action ] ; : left-trim-slice ( string -- string ) #! Return a new string without any leading whitespace @@ -444,9 +443,9 @@ M: action-parser (compile) ( parser -- quot ) TUPLE: sp-parser p1 ; M: sp-parser (compile) ( parser -- quot ) - [ - \ input-slice , \ left-trim-slice , \ input-from , \ pos , \ set , p1>> compiled-parser , - ] [ ] make ; + p1>> compiled-parser 1quotation '[ + input-slice left-trim-slice input-from pos set @ + ] ; TUPLE: delay-parser quot ;