httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: Mod_include design
Date Thu, 02 Nov 2000 17:57:19 GMT
On Thu, Nov 02, 2000 at 10:48:04AM -0800, wrote:
> I wrote:
> > Paul -- yes, a clean parser is much more desirable. From your initial note,
> > I think you are definitely on the right track: a state machine to record
> > where you are in the parsing algorithm (and lexing if you separate that
> > out),
> You can smack me all you want, but a state machine is still
> wrong.  :-)

Ryan, a state machine is how parsers like this work, in our "here is some
more text" model. It is required, but you can deny it all you like :-)

The exact form of that state machine is going to depend upon the grammar,
and on the model that Paul chooses for representing/parsing the grammar. At
a miminum you have two states:

1) not parsing a directive [pass all text up to a directive marker]
2) parsing a directive [accumulate until we have a complete directive]

These two states will exist, but it is entirely reasonable/possible that it
will not be concretely exposed as a two-state machine. The state could
simply be "if anything is in the directive buffer, then we are in state 2;
if the buffer is empty, then we are in state 1".

[ note that "buffer" could be a set-aside brigade; if you don't memcpy a
  directive out of a brigade into a buffer, then the parsing becomes much
  more difficult, and more states would be desirable to control and drive
  the parsing ]


Greg Stein,

View raw message