2012/12/31 <
krupa....@gmail.com>:
This is not supported directly, but there is a slightly hackish way to
implement this: take the input until the caret position and let
PEG.js-generated parser parse this string. It will throw an exception
(complaining about reaching an end of input) whose "expected" property
will contain the completion list.
There is one caveat -- this won't work if the substring passed to the
parser is actually a valid input according to your grammar. In that
case you can just append some string that is guaranteed to be invalid
and do the same trick. But this may not work 100% for all grammars in
all situations.
--
David Majda
Entropy fighter
http://majda.cz/