]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.parser: fix behavior with restarts, reported by mnestic
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 9 Oct 2009 09:25:25 +0000 (04:25 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 9 Oct 2009 09:25:25 +0000 (04:25 -0500)
basis/alien/parser/parser-tests.factor
basis/alien/parser/parser.factor

index 195cbb78a238f0bfb6782ac079b7f027824d56f2..061deb84c5c5bc6115c71353f3db5dd164ce8a82 100644 (file)
@@ -1,6 +1,7 @@
 ! (c)2009 Joe Groff bsd license
 USING: accessors alien.c-types alien.parser alien.syntax
-tools.test vocabs.parser parser ;
+tools.test vocabs.parser parser eval vocabs.parser debugger
+continuations ;
 IN: alien.parser.tests
 
 TYPEDEF: char char2
@@ -28,4 +29,15 @@ SYMBOL: not-c-type
     [ "not-c-type" parse-c-type ] [ no-c-type? ] must-fail-with
     [ "not-word" parse-c-type ] [ error>> no-word-error? ] must-fail-with
 
-] with-file-vocabs
\ No newline at end of file
+] with-file-vocabs
+
+! Reported by mnestic
+TYPEDEF: int alien-parser-test-int ! reasonably unique name...
+
+[ "OK!" ] [
+    [
+        "USE: specialized-arrays SPECIALIZED-ARRAY: alien-parser-test-int" eval( -- )
+        ! after restart, we end up here
+        "OK!"
+    ] [ :1 ] recover
+] unit-test
\ No newline at end of file
index 67f1d4e5fd36bf7107bc4a854fe7a202112d13c8..e4ff5789d2385545a74ddbf8146aca128b59ed3a 100644 (file)
@@ -8,7 +8,7 @@ namespaces summary math vocabs.parser ;
 IN: alien.parser
 
 : parse-c-type-name ( name -- word )
-    dup search [ nip ] [ no-word ] if* ;
+    dup search [ ] [ no-word ] ?if ;
 
 : parse-c-type ( string -- type )
     {
@@ -17,7 +17,7 @@ IN: alien.parser
         { [ dup search c-type-word? ] [ parse-c-type-name ] }
         { [ "**" ?tail              ] [ drop void* ] }
         { [ "*" ?tail               ] [ parse-c-type-name resolve-pointer-type ] }
-        [ parse-c-type-name no-c-type ]
+        [ dup search [ no-c-type ] [ no-word ] ?if ]
     } cond ;
 
 : scan-c-type ( -- c-type )