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

P::RD for tab-completion

Thread Next
From:
Ted Zlatanov
Date:
March 30, 2010 12:00
Subject:
P::RD for tab-completion
Message ID:
87ljd9fy3l.fsf@lifelogs.com
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.

Thanks
Ted


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About