change parse-c-type so that c-type[symbolic-constant] parses to { c-type symbolic-constant }

db4
Joe Groff 2009-10-16 12:27:16 -05:00
parent ce807b0fbb
commit a37bc4828f
2 changed files with 5 additions and 2 deletions

View File

@ -83,7 +83,7 @@ M: string resolve-pointer-type
: parse-array-type ( name -- dims c-type )
"[" split unclip
[ [ "]" ?tail drop string>number ] map ] dip ;
[ [ "]" ?tail drop parse-word ] map ] dip ;
M: string c-type ( name -- c-type )
CHAR: ] over member? [

View File

@ -8,6 +8,8 @@ TYPEDEF: char char2
SYMBOL: not-c-type
CONSTANT: eleven 11
[
"alien.parser.tests" use-vocab
"alien.c-types" use-vocab
@ -15,6 +17,7 @@ SYMBOL: not-c-type
[ int ] [ "int" parse-c-type ] unit-test
[ { int 5 } ] [ "int[5]" parse-c-type ] unit-test
[ { int 5 10 11 } ] [ "int[5][10][11]" parse-c-type ] unit-test
[ { int 5 10 eleven } ] [ "int[5][10][eleven]" parse-c-type ] unit-test
[ void* ] [ "int*" parse-c-type ] unit-test
[ void* ] [ "int**" parse-c-type ] unit-test
[ void* ] [ "int***" parse-c-type ] unit-test
@ -40,4 +43,4 @@ TYPEDEF: int alien-parser-test-int ! reasonably unique name...
! after restart, we end up here
"OK!"
] [ :1 ] recover
] unit-test
] unit-test