[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: push parser

From: Bob Rossi
Subject: Re: push parser
Date: Wed, 27 Sep 2006 09:33:47 -0400
User-agent: Mutt/1.5.11

On Tue, Sep 26, 2006 at 10:28:15AM -0700, Paul Eggert wrote:
> That looks good.  Some minor comments:
> The usual style is to give local variables lower-case names.
> The patch uses upper-caes names for local vars, which looks a bit strange.
> > +]b4_locations_if([status = yypushparse (ctx, ch, &yylval, &yylloc);],
> > +                 [status = yypushparse (ctx, ch, &yylval);])[
> This won't be indented well, and has duplicate code.  The usual style is:
>    status = yypushparse (ctx, ch, &yylval]b4_locations_if([, &yylloc])[);

OK, here's another shot at it. Thanks for the suggestions. How is the
interface coming along? Do you see any other modifications that should
take place?

  struct yypvars *ctx = yypvarsinit ();
  int status, ch;
  do {
    ch = yylex ();
    status = yypushparse (ctx, ch, &yylval, &yylloc);
  } while (status == YYPUSH_MORE);
  free (ctx);
  return status;

One potential problem that I can think of is that the push parser still 
allows the user to use the global variables yylval and yylloc. The push 
parser also has it's own version of these variables in the yypvars 
struct. I don't know if it's a good thing or a bad thing that we still
use the global variables. At a minimum, it will allow users to not have
to modify there lexers. What do you think?

The push parser should also work under multiple contexts (ie
aapushparse, bbpushparse). Can you think of a reason it currently

Bob Rossi

2006-09-27  Bob Rossi  <address@hidden>

        * data/push.c (yychar_set, yylval_set, yylloc_set): Delete.
        (yypushparse): Add YYPVARS, YYLVAL, YYLLOC parameters.
        Use new parameters to setup ypvars structure.
        (yypvarsinit): Add b4_locations_if around init code.
        (yyparse): Modify user interface.

Attachment: push.c.diff
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]