Refactor sp peg parser
							parent
							
								
									d93c7958fd
								
							
						
					
					
						commit
						2744313ac1
					
				| 
						 | 
					@ -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 ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue