]> git.draconx.ca Git - cdecl99.git/log
cdecl99.git
12 years agoSplit advance into two parts.
Nick Bowler [Tue, 5 Jul 2011 00:17:51 +0000 (20:17 -0400)]
Split advance into two parts.

We need to avoid printing spaces after things on occasion.  This makes
the code a little simpler, too.

12 years agoAdd support for empty declarators.
Nick Bowler [Mon, 4 Jul 2011 22:11:51 +0000 (18:11 -0400)]
Add support for empty declarators.

This allows the parser to recognize type names which are required for
function prototypes, as well as actual declarations.  This also makes it
easy to let the user ask for an explanation of types.  For instance:

  explain int *(*[])[];

prints

  type array of pointer to array of pointer to int.

12 years agoUse assert(0) instead of abort for exceptional cases.
Nick Bowler [Mon, 4 Jul 2011 22:11:48 +0000 (18:11 -0400)]
Use assert(0) instead of abort for exceptional cases.

assert prints helpful context info to stderr.  These cases should never
be reached except by programmer error.

12 years agoAdd support for explaining multiple declarators.
Nick Bowler [Mon, 4 Jul 2011 22:10:49 +0000 (18:10 -0400)]
Add support for explaining multiple declarators.

12 years agoFix error handling in explain.
Nick Bowler [Mon, 4 Jul 2011 22:10:30 +0000 (18:10 -0400)]
Fix error handling in explain.

On a memory allocation failure, we leak the decl allocated by the
parser.  Fix that up.

12 years agoAdd support for array declarators.
Nick Bowler [Sat, 25 Jun 2011 13:45:16 +0000 (09:45 -0400)]
Add support for array declarators.

Currently there is a (I think quite reasonable) restriction that the
array length either be unspecified, a positive integer constant, an
identifier, or *.

12 years agoAdd support for pointer declarators.
Nick Bowler [Sat, 25 Jun 2011 13:41:41 +0000 (09:41 -0400)]
Add support for pointer declarators.

12 years agoFix comment about automatic generation in typenames.sed.
Nick Bowler [Sat, 25 Jun 2011 13:34:09 +0000 (09:34 -0400)]
Fix comment about automatic generation in typenames.sed.

Last I checked, typenames.sed is not validtypes.sed.

12 years agoRestrict the contexts in which typedef names can appear.
Nick Bowler [Sat, 25 Jun 2011 12:52:17 +0000 (08:52 -0400)]
Restrict the contexts in which typedef names can appear.

This should resolve a rather nasty ambiguity in the C grammar:

  [declaration] -> [declaration-specifiers] ;
                -> [type-specifier] [declaration-specifiers] ;
                -> int [declaration-specifiers] ;
                -> int [type-specifier] ;
                -> int [typedef-name] ;
                -> int [identifier] ;
                -> int x ;

versus

  [declaration] -> [declaration-specifiers] [init-declarator-list] ;
                -> [type-specifier] [init-declarator-list] ;
                -> int [init-declarator-list] ;
                -> int [init-declarator] ;
                -> int [declarator] ;
                -> int [direct-declarator] ;
                -> int [identifier] ;
                -> int x ;

The standard resolves this ambiguity by having a constraint that is not
part of the context-free grammar.  This ambiguity gets really nasty with
things like int f (x); -- is it a declaration of x with two type
specifiers or a declaration of f (a function with one parameter) with
with one type specifier?

A side-effect of this change is that the parser will now reject
declarations without any type specifiers at all, which probably makes
the error messages a bit less informative.

12 years agoFix VPATH builds from git.
Nick Bowler [Sat, 25 Jun 2011 00:26:25 +0000 (20:26 -0400)]
Fix VPATH builds from git.

In such builds, C source files (that are normally distributed) get
generated, which means they end up in the build tree.  Building them
subsequently fails because headers (in the source tree) are not found.

12 years agoSplit out qualifier explanations from explain_post_specs.
Nick Bowler [Fri, 24 Jun 2011 13:42:53 +0000 (09:42 -0400)]
Split out qualifier explanations from explain_post_specs.

They'll be needed on their own for pointer explanations.

12 years agoFix the distribution.
Nick Bowler [Fri, 24 Jun 2011 00:50:02 +0000 (20:50 -0400)]
Fix the distribution.

Now make distcheck passes.

12 years agoInitial support for explaining declarations.
Nick Bowler [Fri, 24 Jun 2011 00:24:50 +0000 (20:24 -0400)]
Initial support for explaining declarations.

This should support everything that the parser currently does.

12 years agoAdd a function to turn a typemap into a string.
Nick Bowler [Fri, 24 Jun 2011 00:24:32 +0000 (20:24 -0400)]
Add a function to turn a typemap into a string.

12 years agoAllow (and ignore) underscores in the list of type names.
Nick Bowler [Thu, 23 Jun 2011 00:30:53 +0000 (20:30 -0400)]
Allow (and ignore) underscores in the list of type names.

This allows the "true" keywords to be used in the list.

12 years agoKill typemap_is_valid.
Nick Bowler [Thu, 23 Jun 2011 00:30:52 +0000 (20:30 -0400)]
Kill typemap_is_valid.

Just do the check when building the map in the first place.  This
enables more useful error messages, too: the case where there are no
type specifiers at all is certainly worth diagnosing separately from
other kinds of nonsense.

12 years agoAdd initial command parser.
Nick Bowler [Thu, 23 Jun 2011 00:30:50 +0000 (20:30 -0400)]
Add initial command parser.

12 years agoImplement the interactive cdecl99 loop.
Nick Bowler [Thu, 23 Jun 2011 00:30:41 +0000 (20:30 -0400)]
Implement the interactive cdecl99 loop.

Bring in gnulib for getopt_long and readline support.

12 years agoMake cdecl_free more robust by handling a NULL argument.
Nick Bowler [Thu, 23 Jun 2011 00:30:17 +0000 (20:30 -0400)]
Make cdecl_free more robust by handling a NULL argument.

While we're at it, split the function into two so that the parser
doesn't have to call the exported version.

12 years agoMove typemap stuff into a separate file.
Nick Bowler [Tue, 21 Jun 2011 22:29:30 +0000 (18:29 -0400)]
Move typemap stuff into a separate file.

These functions will be generally useful.  They are not part of the
public API, so we use the cdecl__ prefix for internal functions.

While we're at it, make the code easier to understand by automatically
generating the huge switch statement and eliminating the silly macros.

12 years agoRename libcdecl.c to parse-decl.c
Nick Bowler [Tue, 21 Jun 2011 22:29:12 +0000 (18:29 -0400)]
Rename libcdecl.c to parse-decl.c

Paving the way for having more than one source file.

12 years agoDon't use missing for flex.
Nick Bowler [Tue, 21 Jun 2011 22:29:02 +0000 (18:29 -0400)]
Don't use missing for flex.

Oops, that was a leftover from early testing.

12 years agoFix Makefile dependencies.
Nick Bowler [Tue, 21 Jun 2011 22:28:32 +0000 (18:28 -0400)]
Fix Makefile dependencies.

Dependencies of foo.$(OBJEXT) are not honoured when building a libtool
library; instead we need to use foo.lo.

12 years agoAdd m4/.gitignore.
Nick Bowler [Tue, 21 Jun 2011 22:28:18 +0000 (18:28 -0400)]
Add m4/.gitignore.

This ensures that the m4 directory exists in the git checkout.

12 years agoDon't touch unchanged flex/bison headers.
Nick Bowler [Tue, 21 Jun 2011 01:35:13 +0000 (21:35 -0400)]
Don't touch unchanged flex/bison headers.

This prevents some spurious rebuilds.

12 years agoAdd an initial declaration parser.
Nick Bowler [Tue, 21 Jun 2011 01:34:45 +0000 (21:34 -0400)]
Add an initial declaration parser.

12 years agoInitial commit
Nick Bowler [Sun, 19 Jun 2011 17:21:17 +0000 (13:21 -0400)]
Initial commit