lexx.parser.ast.java
Class ParseJavaAST

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--lexx.parser.ast.java.ParseJavaAST
All Implemented Interfaces:
java.lang.Runnable

public final class ParseJavaAST
extends java.lang.Thread

Factory class for parsing java code

This class parses java code however this can handles non-determenistic errors. Worst case is getting in an infinate loop and running out of memory

This class parses java code in a separate thread, therefore I can stop parsing whenever I want.

Copyright (c) 2002-2003

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

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static JavaAST parseComplete(java.lang.String code)
          This parse java code into a JavaAST
static JavaAST parsePartially(java.lang.String code)
          This parse java code into a JavaAST.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

parsePartially

public static JavaAST parsePartially(java.lang.String code)
                              throws antlr.TokenStreamException,
                                     antlr.RecognitionException
This parse java code into a JavaAST. The java syntax is more relaxed complared to parseComplete. Also this method will throw an exception when another thread runs this method. This ensures that at java code is only parse once at a time.

Parameters:
code - - the java source code
Returns:
- JavaAST of the source code
Throws:
antlr.TokenStreamException - error during parsing - code is syntaxically incorrect
antlr.RecognitionException - error during parsing - code is syntaxically incorrect

parseComplete

public static JavaAST parseComplete(java.lang.String code)
                             throws antlr.TokenStreamException,
                                    antlr.RecognitionException
This parse java code into a JavaAST

Parameters:
code - - the java source code
Returns:
- JavaAST of the source code
Throws:
antlr.TokenStreamException - error during parsing - code is syntaxically incorrect
antlr.RecognitionException - error during parsing - code is syntaxically incorrect

run

public final void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread