ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe.reader
Class SrcReader

java.lang.Object
  extended byjavafe.reader.Reader
      extended byjavafe.reader.SrcReader

public class SrcReader
extends Reader

A SrcReader is a Reader that reads in a CompilationUnit from a source file (.java files) using the javafe.parser package.

SrcReaders do not cache the results of their reading.


Field Summary
private  Lex readLex
          * Creation: * *
private  Parse readParser
           
 
Constructor Summary
SrcReader()
           
SrcReader(PragmaParser p)
           
 
Method Summary
static void main(java.lang.String[] args)
          * Test methods: * *
 CompilationUnit read(GenericFile target, boolean avoidSpec)
          Attempt to read and parse a CompilationUnit from *source* target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readLex

private Lex readLex
* Creation: * *


readParser

private Parse readParser
Constructor Detail

SrcReader

public SrcReader()

SrcReader

public SrcReader(PragmaParser p)
Method Detail

read

public CompilationUnit read(GenericFile target,
                            boolean avoidSpec)
Attempt to read and parse a CompilationUnit from *source* target. Any errors encountered are reported via javafe.util.ErrorSet. Null is returned iff an error was encountered.

By default, we attempt to read only a spec (e.g., specOnly is set in the resulting CompilationUnit) to save time. If avoidSpec is true, we always return a non-spec (if the file is a .java file).

The result of this function is not cached.

Target must be non-null.

Specified by:
read in class Reader
Parameters:
target - The source to be read
avoidSpec - If true, then bodies are parsed as well, if possible; if false, no method bodies are parsed.
Returns:
The resulting compilation unit, or null if an error occurred during parsing

main

public static void main(java.lang.String[] args)
* Test methods: * *


ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage