The summary methods doesn't need dedicated vocabs. Unlike prettyprint methods.
+++ /dev/null
-! Copyright (C) 2010 Joe Groff.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types alien.parser prettyprint
-sequences summary ;
-IN: alien.debugger
-
-M: no-c-type summary name>> unparse "“" "” is not a C type" surround ;
-
-M: *-in-c-type-name summary
- name>> "Cannot define a C type “" "” that ends with an asterisk (*)" surround ;
! (c)2009 Joe Groff bsd license
USING: accessors alien.c-types alien.parser alien.parser.private
alien.syntax compiler.units continuations debugger eval fry kernel
-lexer namespaces parser sequences sets tools.test vocabs.parser words
-;
+lexer namespaces parser sequences sets summary tools.test
+vocabs.parser words ;
IN: alien.parser.tests
<<
{ "ayae" } [ parse-enum-name new-definitions get first in? ] with-parsing
] unit-test
+! validate-c-type-name
+{ "Cannot define a C type “hello*” that ends with an asterisk (*)" } [
+ [ "hello*" validate-c-type-name ] [ ] recover summary
+] unit-test
+
>>
TYPEDEF: char char2
USING: accessors alien alien.c-types alien.enums alien.libraries
arrays classes classes.parser combinators combinators.short-circuit
compiler.units effects fry kernel lexer locals math namespaces parser
-sequences splitting vocabs.parser words ;
+sequences splitting summary vocabs.parser words ;
IN: alien.parser
SYMBOL: current-library
ERROR: *-in-c-type-name name ;
+M: *-in-c-type-name summary
+ name>>
+ "Cannot define a C type “"
+ "” that ends with an asterisk (*)" surround ;
+
: validate-c-type-name ( name -- name )
dup "*" tail?
[ *-in-c-type-name ] when ;
] unless
{ "boostrap.compiler" "prettyprint" } "alien.prettyprint" require-when
-{ "boostrap.compiler" "debugger" } "alien.debugger" require-when
"cpu." cpu name>> append require