infix: crazy infix methods idea, dunno if it is awesome yet.
							parent
							
								
									da5eedce32
								
							
						
					
					
						commit
						db81422ff4
					
				| 
						 | 
					@ -50,3 +50,7 @@ IN: infix.tests
 | 
				
			||||||
[ "rbo" ] [ [let "foobar" :> s [infix s[::-2] infix] ] ] unit-test
 | 
					[ "rbo" ] [ [let "foobar" :> s [infix s[::-2] infix] ] ] unit-test
 | 
				
			||||||
[ "rbo" ] [ [let "foobar" :> s [infix s[:0:-2] infix] ] ] unit-test
 | 
					[ "rbo" ] [ [let "foobar" :> s [infix s[:0:-2] infix] ] ] unit-test
 | 
				
			||||||
[ "rb" ] [ [let "foobar" :> s [infix s[:-5:-2] infix] ] ] unit-test
 | 
					[ "rb" ] [ [let "foobar" :> s [infix s[:-5:-2] infix] ] ] unit-test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INFIX:: foo ( x y -- z ) x**2-abs(y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{ 194 } [ 15 31 foo ] unit-test
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,9 @@
 | 
				
			||||||
! Copyright (C) 2009 Philipp Brüschweiler
 | 
					! Copyright (C) 2009 Philipp Brüschweiler
 | 
				
			||||||
! See http://factorcode.org/license.txt for BSD license.
 | 
					! See http://factorcode.org/license.txt for BSD license.
 | 
				
			||||||
USING: accessors assocs combinators combinators.short-circuit
 | 
					USING: accessors assocs combinators effects effects.parser fry
 | 
				
			||||||
effects fry infix.parser infix.ast kernel locals locals.parser
 | 
					infix.ast infix.parser kernel locals locals.parser math
 | 
				
			||||||
locals.types math math.functions math.order math.ranges
 | 
					math.functions math.order math.ranges multiline namespaces
 | 
				
			||||||
multiline namespaces parser quotations sequences summary
 | 
					parser quotations sequences summary words ;
 | 
				
			||||||
words vocabs.parser ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
IN: infix
 | 
					IN: infix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<PRIVATE
 | 
					<PRIVATE
 | 
				
			||||||
| 
						 | 
					@ -120,3 +118,15 @@ PRIVATE>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SYNTAX: [infix
 | 
					SYNTAX: [infix
 | 
				
			||||||
    "infix]" parse-infix-quotation suffix! \ call suffix! ;
 | 
					    "infix]" parse-infix-quotation suffix! \ call suffix! ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<PRIVATE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					: (INFIX::) ( -- word def effect )
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					        scan-new-word
 | 
				
			||||||
 | 
					        [ ";" parse-infix-quotation ] parse-locals-definition
 | 
				
			||||||
 | 
					    ] with-definition ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PRIVATE>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SYNTAX: INFIX:: (INFIX::) define-declared ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue