develooper Front page | perl.recdescent | Postings from March 2010

P::RD for tab-completion

Thread Next
Ted Zlatanov
March 30, 2010 12:00
P::RD for tab-completion
Message ID:
I've got a working grammar that will parse, say

A a1 a2 a3
B b1 b2

into structures.  A and B don't overlap so I know that any sequence
beginning with A must have a1, a2, and a3.

Now I'm interested in finding out how much of the A rule can be matched,
for tab-completion (so I can tell if a1, a2, or a3 should be
completed).  I'm using Term::ReadLine::Gnu but that's not too
important.  Basically I want, given "A a1", to say "oh you want all the
possible values for a2 and a1 is already given."

I'm currently doing this by making a1..3 optional and then assembling
them back in order, but was wondering if there's a better way to fail
the match but tell me how far the parser got before it failed.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About