At 03:37 PM 6/16/99 +0000, William Flanders wrote:
ound.
>
>If the JDE package is going to come with the API... then we can arrange it
>how we wish, and even have
>D:/jdk1.2/docs/api/java/awt/Vector/size.html
>
>Going further than this would be difficult, however... say,
>Vector v = new Vector();
>v.clone().clone();
>
>Is the elisp parser sufficient to know what a return type of an expression
>is?  And precedence?
>

Yes.

I built the JDE's Java parser using the JavaCC parser builder and complete
Java grammar developed by Sun itself. The generated parser uses the visitor
design pattern. This enable code that uses the parser to extract  any
information to any level of detail that it wants from the parse tree
generated by the parser for the current compilation unit, i.e., the
contents of the current Emacs Java source buffer. The parser is written in
Java so you have to invoke the parser using the BeanShell. The JDE includes
an elisp function, bsh-eval, that serves as an interface to the BeanShell.
bsh-eval uses BeanShell to evaluate any Java source expression passed to
it, e.g.. 

(bsh-eval "import jde.parser.Parser;")
(setq parse-error (bsh-eval-r
"Parser.parse(\"d:/jdk1.2/src/java/awt/Vector.java\");")))
 (if parse-error (message parse-error))

There is a special version called bsh-eval-r that expects to receive a Lisp
expression back from the BeanShell. If it does, it evaluates the
expression. The the Emacs side can talk to the Java side (e.g, the
BeanShell) in Java and the Java side can talk back in elisp.

- Paul

Reply via email to