|  Home |  Back |  Contents |  Next | 
| java bsh.Parser [ -p ] file [ file ] [ ... ] | 
| 
// From Java
import bsh.Interpreter;
i=new Interpreter();
// Declare method or source from file
i.eval("foo( args ) { ... }");
i.eval("foo(args)"); // repeatedly invoke the method
i.eval("foo(args)");
...
 | 
| 
in=new FileReader("somefile.bsh");
Parser parser = new Parser(in);
while( !(eof=parser.Line()) ) {
    SimpleNode node = parser.popNode();
    // Use the node, etc. (See the bsh.BSH* classes)
    ...
}
 | 
| Tip: The BshDoc bshdoc.bsh script uses the parser to extract method signatures and comments from a BeanShell file. Check it out for a more realistic example. | 
|  Home |  Back |  Contents |  Next |