STRUCT: T-class
{ NAME int }
- { "x" { TYPE 4 } }
- { "y" { "short" N } }
- { "z" TYPE initial: 5 }
- { "w" { "int" 2 } } ;
+ { x { TYPE 4 } }
+ { y { "short" N } }
+ { z TYPE initial: 5 }
+ { float { "float" 2 } } ;
;FUNCTOR
{ c-type "char" }
}
T{ struct-slot-spec
- { name "w" }
+ { name "float" }
{ offset 16 }
{ class object }
{ initial f }
- { c-type { "int" 2 } }
+ { c-type { "float" 2 } }
}
}
] [ a-struct struct-slots ] unit-test
[ parse-definition* ] dip
parsed ;
+: >string-param ( string -- string/param )
+ dup search dup lexical? [ nip ] [ drop ] if ;
+
: scan-c-type* ( -- c-type/param )
- scan {
- { [ dup "{" = ] [ drop \ } parse-until >array ] }
- { [ dup search ] [ search ] }
- [ ]
- } cond ;
+ scan dup "{" = [ drop \ } parse-until >array ] [ >string-param ] if ;
+
+: scan-string-param ( -- name/param )
+ scan >string-param ;
:: parse-struct-slot* ( accum -- accum )
- scan-param :> name
+ scan-string-param :> name
scan-c-type* :> c-type
\ } parse-until :> attributes
accum {