X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/3df85155e2dbf9307dd64bd222bf74389c45a75c..c0b4acddf86a9dd0a7d8d8f8cc096cfec771bca7:/doc/man/libcdecl.3 diff --git a/doc/man/libcdecl.3 b/doc/man/libcdecl.3 index 489d7a9..a4dc5f4 100644 --- a/doc/man/libcdecl.3 +++ b/doc/man/libcdecl.3 @@ -17,6 +17,7 @@ .Fd const struct cdecl_error *cdecl_get_error(void); .Pp .Fd int cdecl_spec_kind(struct cdecl_declspec *spec); +.Fd bool cdecl_is_abstract(struct cdecl_declarator *declarator); .Sh DESCRIPTION .Nm provides support for parsing C declarations and translating them to something @@ -193,11 +194,21 @@ member is interpreted as "function returning child". .El .Ss Terminal Declarators Null and identifier declarators have no children and are thus leaf nodes. A -null declarator indicates an abstract declarator; that is, one which does not -declare any identifier. Such declarators appear in type names and possibly -function parameters. An identifier declarator has the obvious meaning; the +null declarator is not strictly a C language construct, but is used by +.Nm +to indicate an abstract declarator; that is, one which does not declare any +identifier. Such declarators appear in type names and possibly function +parameters. An identifier declarator has the obvious meaning; the .Va ident union member points to the C string containing the identifier. +.Pp +Since a null declarator may be deeply nested in the declarator chain, the +function +.Pp +.Fd bool cdecl_is_abstract(struct cdecl_declarator *declarator); +.Pp +can be used to determine whether or not a given declarator declares an +identifier. The result is true if and only if the declarator is abstract. .Ss Pointer Declarators .Bd -literal -offset indent struct cdecl_pointer { @@ -246,6 +257,13 @@ each function parameter has exactly one full declarator (abstract or otherwise). If .Va variadic is true, then the function is variadic. +.Pp +Note that old-style function declarations with non-empty identifier lists are +not directly represented here: this is because they are syntactically identical +to a prototype where every parameter is a typedef name. Since +.Nm +isn't a C compiler, there is no way for the parser to tell these two kinds of +declarations apart. .Sh ERROR HANDLING Some functions in .Nm