Re: Evaluating script syntax
"Gary M" <[email protected]> Thu, 28 Aug 2008 10:27:13 -0400
| Newsgroups | gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
I wrote a plugin for jEdit to validate the current Beanshell buffer and this
is what I did:
try {
for (Parser parser = new Parser(new StringReader(...)); !parser.Line();
parser.popNode());
} catch (TokenMgrError e) {
//
} catch (ParseException e) {
//
}
On Wed, Aug 27, 2008 at 3:21 PM, Kirby Files <[email protected]> wrote:
> A really long time ago, I wrote code for the bsh v1.01 API which
> evaluated the syntax of a script without executing it. It went
> something like this:
>
> StringReader in = new StringReader( script );
> Interpreter parse = new Interpreter( in );
> boolean eof = false;
> while ( !(eof=parse.Line()) ) {}
>
>
> After upgrading to v1.3 (several years after the beanshell project
> became defunct), I found that there was no equivalent to
> Interpreter.Line(). Is there any way to achieve the same result with
> this API?
>
> The reason we do this is that BSH is the core of an online script
> editing framework. After an engineer edits a script and saves it, the
> script is immediately checked for correctness. If it fails to parse,
> the engineer is shown the offending line and given a chance to correct it.
>
> Without such a feature, we have to wait and test the script by
> executing it for real. This is significantly harder to debug,
> particularly since many scriptfiles can be assembled into a larger
> executable.
>
> Thanks,
> --kirby files
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Beanshell-users mailing list
> Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
--
--
Gary
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Beanshell-users mailing list
Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-users