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

escjava.reader
Class EscTypeReader

java.lang.Object
  extended byjavafe.reader.Reader
      extended byjavafe.reader.TypeReader
          extended byjavafe.reader.StandardTypeReader
              extended byescjava.reader.EscTypeReader

public class EscTypeReader
extends StandardTypeReader

An EscTypeReader is a StandardTypeReader extended to understand ".spec" files.


Field Summary
(package private)  java.lang.String[] activeSuffixes
           
(package private)  java.lang.String[] nonJavaSuffixes
           
 
Fields inherited from class javafe.reader.StandardTypeReader
binaryReader, javaFileSpace, javaSrcFileSpace, sourceReader
 
Constructor Summary
protected EscTypeReader(Query engine, Query srcEngine, CachedReader srcReader, CachedReader binReader)
          Create an ESCTypeReader from a query engine, a source reader, and a binary reader.
 
Method Summary
(package private)  boolean containsSpecOnly(CompilationUnit cu)
          Does a CompilationUnit contain a specOnly TypeDecl?
 boolean exists(java.lang.String[] P, java.lang.String T)
          Return true iff the fully-qualified outside type P.T exists.
 java.io.FilenameFilter filter()
           
 GenericFile findBinFile(java.lang.String[] P, java.lang.String filename)
           
 GenericFile findFirst(java.lang.String[] P, java.lang.String T)
           
 GenericFile findSrcFile(java.lang.String[] P, java.lang.String filename)
           
 GenericFile findType(java.lang.String[] P, java.lang.String T)
          Returns a (source or binary) file for the given type.
static void main(java.lang.String[] args)
           
static StandardTypeReader make()
          Create a EscTypeReader using the default Java classpath for our underlying Java file space and no pragma parser.
static StandardTypeReader make(PragmaParser pragmaP)
          Create a EscTypeReader using a the default Java classpath for our underlying Java file space and a given pragma parser.
static StandardTypeReader make(Query engine, Query srcEngine, CachedReader srcReader, CachedReader binReader)
          Create a EscTypeReader from a query engine, a source reader, and a binary reader.
static StandardTypeReader make(Query Q, Query sourceQ, PragmaParser pragmaP, AnnotationHandler ah)
          Create a EscTypeReader from a non-null query engine and a pragma parser.
static StandardTypeReader make(java.lang.String path, java.lang.String srcPath, PragmaParser pragmaP, AnnotationHandler ah)
          Create a EscTypeReader using a given Java classpath for our underlying Java file space and a given pragma parser.
 CompilationUnit read(GenericFile f, boolean avoidSpec)
          Attempt to read and parse a CompilationUnit from source file target.
 CompilationUnit read(java.lang.String[] P, java.lang.String T, boolean avoidSpec)
          Override StandardTypeReader.read(String[], String, boolean) method to include ".spec" files.
 
Methods inherited from class javafe.reader.StandardTypeReader
accessable, clear, findFiles, locateBinary, locateSource, make, make, make, queryFromClasspath, readTypeBinaries, readTypeSrc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeSuffixes

java.lang.String[] activeSuffixes

nonJavaSuffixes

java.lang.String[] nonJavaSuffixes
Constructor Detail

EscTypeReader

protected EscTypeReader(Query engine,
                        Query srcEngine,
                        CachedReader srcReader,
                        CachedReader binReader)
Create an ESCTypeReader from a query engine, a source reader, and a binary reader. All arguments must be non-null.

Method Detail

make

public static StandardTypeReader make(Query engine,
                                      Query srcEngine,
                                      CachedReader srcReader,
                                      CachedReader binReader)
Create a EscTypeReader from a query engine, a source reader, and a binary reader. All arguments must be non-null.


make

public static StandardTypeReader make(Query Q,
                                      Query sourceQ,
                                      PragmaParser pragmaP,
                                      AnnotationHandler ah)
Create a EscTypeReader from a non-null query engine and a pragma parser. The pragma parser may be null.


make

public static StandardTypeReader make(java.lang.String path,
                                      java.lang.String srcPath,
                                      PragmaParser pragmaP,
                                      AnnotationHandler ah)
Create a EscTypeReader using a given Java classpath for our underlying Java file space and a given pragma parser. If the given path is null, the default Java classpath is used.

A fatal error will be reported via ErrorSet if an I/O error occurs while initially scanning the filesystem.


make

public static StandardTypeReader make(PragmaParser pragmaP)
Create a EscTypeReader using a the default Java classpath for our underlying Java file space and a given pragma parser.

A fatal error will be reported via ErrorSet if an I/O error occurs while initially scanning the filesystem.


make

public static StandardTypeReader make()
Create a EscTypeReader using the default Java classpath for our underlying Java file space and no pragma parser.

A fatal error will be reported via ErrorSet if an I/O error occurs while initially scanning the filesystem.


exists

public boolean exists(java.lang.String[] P,
                      java.lang.String T)
Return true iff the fully-qualified outside type P.T exists.

Overrides:
exists in class StandardTypeReader

findFirst

public GenericFile findFirst(java.lang.String[] P,
                             java.lang.String T)

findSrcFile

public GenericFile findSrcFile(java.lang.String[] P,
                               java.lang.String filename)

findBinFile

public GenericFile findBinFile(java.lang.String[] P,
                               java.lang.String filename)

findType

public GenericFile findType(java.lang.String[] P,
                            java.lang.String T)
Description copied from class: TypeReader
Returns a (source or binary) file for the given type.

Overrides:
findType in class StandardTypeReader

filter

public java.io.FilenameFilter filter()
Overrides:
filter in class StandardTypeReader

read

public CompilationUnit read(GenericFile f,
                            boolean avoidSpec)
Description copied from class: StandardTypeReader
Attempt to read and parse a CompilationUnit from source file target. Any errors encountered are reported via 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 return a non-spec, except in the case where we have previously read in the same source file with avoidSpec false. (See notes on caching below.)

There are 2 safe ways to ensure source files yield non-spec files: (1) always use avoidSpec, or (2) read all desired non-spec's at the beginning with avoidSpec set. [these instructions apply to both versions of read.]

The result of this function is cached. Note that StandardTypeReader.read(String[], String, boolean) may implicitly call this function, resulting in caching of source files.

Only the value of avoidSpec used the first time a given file is read is used (including implicit calls). This may result in a spec being returned unnecessarily when avoidSpec is true.

Target must be non-null.

Overrides:
read in class StandardTypeReader

read

public CompilationUnit read(java.lang.String[] P,
                            java.lang.String T,
                            boolean avoidSpec)
Override StandardTypeReader.read(String[], String, boolean) method to include ".spec" files.

Overrides:
read in class StandardTypeReader

containsSpecOnly

boolean containsSpecOnly(CompilationUnit cu)
Does a CompilationUnit contain a specOnly TypeDecl?


main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

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