lexx.parser
Class JavaParserListener

java.lang.Object
  |
  +--lexx.parser.ParserListener
        |
        +--lexx.parser.JavaParserListener
All Implemented Interfaces:
javax.swing.event.DocumentListener, java.util.EventListener

public final class JavaParserListener
extends ParserListener

Performs parsing on a java and produces a JavaAST

This package takes in an DocumentEvent and creates an AST from the java source code.

At the moment parsing occurs in two stages

1) When the user enters a keyword such as ';', '{' or '}'

2) An timer is used to perfom the parsing on non keyworks

Copyright (c) 2002-2003

Since:
20/03/2003
Version:
1.0
Author:
Mohammed Imran

Field Summary
 
Fields inherited from class lexx.parser.ParserListener
analyse, code, doc, log, pack, root
 
Constructor Summary
JavaParserListener(JavaPackages packages, javax.swing.JTextPane pane)
          Performs paring on a java and produces a JavaAST
 
Method Summary
 ASTAnalyser getAnalyser()
           
 IncrementAST getIncrementAST(int pos)
           
 boolean isDebugASTVisible()
           
protected  void scan(javax.swing.event.DocumentEvent changed, boolean wasTextInserted)
          Where parsing of the java code actually occurs
protected  void scanIncrmental(javax.swing.event.DocumentEvent chng, boolean wasInserted)
          Uses incrmental parsing note this is still under construction
 void setVisibleDebugAST(boolean answer)
           
 
Methods inherited from class lexx.parser.ParserListener
changedUpdate, getAnalyse, getCoord, getPos, insertUpdate, removeUpdate, setAnalyse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaParserListener

public JavaParserListener(JavaPackages packages,
                          javax.swing.JTextPane pane)
Performs paring on a java and produces a JavaAST

Parameters:
packages - required to analyse the AST can find variable declarations
pane - required to get the text from the java code
Method Detail

getAnalyser

public final ASTAnalyser getAnalyser()
Specified by:
getAnalyser in class ParserListener

scan

protected final void scan(javax.swing.event.DocumentEvent changed,
                          boolean wasTextInserted)
Where parsing of the java code actually occurs

At the moment parsing occurs in two stages

1) When the user enters a keyword such as ';', '{' or '}'

2) An timer is used to perfom the parsing on non keyworks

also note that this runs in a thread so the user isn't waiting for the java code to parse

Specified by:
scan in class ParserListener
Parameters:
changed - the documentevent telling where the change of text occured
wasTextInserted - tells you if the text was inserted or removed

scanIncrmental

protected final void scanIncrmental(javax.swing.event.DocumentEvent chng,
                                    boolean wasInserted)
Uses incrmental parsing note this is still under construction


setVisibleDebugAST

public final void setVisibleDebugAST(boolean answer)

getIncrementAST

public final IncrementAST getIncrementAST(int pos)

isDebugASTVisible

public final boolean isDebugASTVisible()