]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.parser: change scan-c-args to always use ";" as end-marker in preparation for...
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Jul 2015 22:08:56 +0000 (15:08 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Jul 2015 22:08:56 +0000 (15:08 -0700)
basis/alien/parser/parser.factor
basis/opengl/gl/extensions/extensions.factor

index 4276eed6e69e9108d35b2d9514c49636caca4eb5..73c9c0a9113c9ee9ff9a2d0765a5a65a91c5dfe1 100755 (executable)
@@ -112,20 +112,15 @@ PRIVATE>
 : scan-function-name ( -- return function )
     scan-c-type scan-token parse-pointers ;
 
-:: (scan-c-args) ( end-marker types names -- )
-    scan-token :> type-str
-    type-str end-marker = [
-        type-str { "(" ")" } member? [
-            type-str parse-c-type :> type
-            scan-token "," ?tail drop :> name
-            type name parse-pointers :> ( type' name' )
-            type' types push name' names push
-        ] unless
-        end-marker types names (scan-c-args)
-    ] unless ;
-
-: scan-c-args ( end-marker -- types names )
-    V{ } clone V{ } clone [ (scan-c-args) ] 2keep [ >array ] bi@ ;
+:: scan-c-args ( -- types names )
+    V{ } clone :> types
+    V{ } clone :> names
+    "(" expect scan-token [ dup ")" = ] [
+        parse-c-type
+        scan-token "," ?tail drop
+        parse-pointers [ types push ] [ names push ] bi*
+        scan-token
+    ] until drop ";" expect types names [ >array ] bi@ ;
 
 : function-quot ( return library function types -- quot )
     '[ _ _ _ _ alien-invoke ] ;
@@ -145,7 +140,7 @@ PRIVATE>
     return function library types names (make-function) ;
 
 : (FUNCTION:) ( -- return function library types names )
-    scan-function-name current-library get ";" scan-c-args ;
+    scan-function-name current-library get scan-c-args ;
 
 : callback-quot ( return types abi -- quot )
     '[ [ _ _ _ ] dip alien-callback ] ;
@@ -160,7 +155,7 @@ PRIVATE>
 
 : (CALLBACK:) ( -- word quot effect )
     current-library get
-    scan-function-name ";" scan-c-args make-callback-type ;
+    scan-function-name scan-c-args make-callback-type ;
 
 PREDICATE: alien-function-alias-word < word
     def>> {
index 180344de312761c26ac943aead20c1d752f92090..15d225bd04dfbbeef582fafe6abeb4a2becb8aca 100644 (file)
@@ -52,4 +52,4 @@ SYNTAX: GL-FUNCTION:
     scan-function-name
     "{" expect "}" parse-tokens over suffix
     gl-function-counter '[ _ _ gl-function-pointer ]
-    ";" scan-c-args define-indirect ;
+    scan-c-args define-indirect ;