Re: newlines and no newlines
[email protected] ("Cortland D. Starrett")
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
I try giving the entire text in one call and still fail... $parser->db( $schema = ::loadfile( $schemafile ) ); ??? Cortland Starrett On Mon, 26 Nov 2001, Damian Conway wrote: > > Hi Cortland. > > You noted: > > > The following grammar parses fine with no intermixed newlines. > > It fails with newlines. E.g.: > > > > c t a b int B # parses > > c t a > > b int B # does not > > > > I do not understand why the second fails. Insight? > > The problem is not in RecDescent. The problem is in: > > > while (<>) > > which reads in a single line at a time and sends it to the parser. > > So, in the case of intermixed newlines, it just reads in "c t a\n" or > just reads in "b int B\n", neither of which individually satisfies > the grammar. > > And, to anticipate the obvious follow-up question: no, there is currently > no easy way to set up a RecDescent grammar that parses incrementally. > I'm working on that, but it really requires incremental regex matches, > which will probably not be available until Perl 6. :-( > > Damian