change parse-c-type so that c-type[symbolic-constant] parses to { c-type symbolic-constant }
parent
ce807b0fbb
commit
a37bc4828f
|
@ -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? [
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue