| java.lang.Object de.gulden.util.javasource.SourceParser
Method Summary | |
protected static void | analysePass1(Package basePackage, InputStream in, String source, ProgressTracker pt) | protected static void | analysePass2(Package pack, ProgressTracker pt) Parsing pass 2.
Now that all classes in packages are already known,
unqualified references can be qualified clearly. | public static void | buildSource(Package p, File dir, File[] sources, Sourclet sourclet) Output object tree of source code elements as Java source files,
applying a Sourclet for formatting the code.
Parameters: p - Package containing all other packages with classes that are to be output as formatted source code. Parameters: dir - Base directory where to output .java-files. | public static Document | buildXML(Package p) Output an object tree of source code elements to XML.
Parameters: p - Package containing all other packages with classes that are to be converted to XML. | protected static char | endsQuoted(String s) | protected static DocumentBuilder | getDocumentBuilder() Creates XML document builder. | public static String | indent(String s, int depth) Tool function: indent a multi-line string by depth blank characters in front of each line. | protected static void | log(String msg) Outputs a log message if the verbose-flag is set.. | public static Package | parse(File file, ProgressTracker pt) Create object tree from Java source inputs. | public static Package | parse(File[] files, ProgressTracker pt) Create object tree from Java source inputs.
Parameters: files - A list of files and/or directories. | public static void | parse(File[] files, Package basePackage, ProgressTracker pt) Parses files and adds the parsed objects to the specified base package. | public static void | parse(File file, Package basePackage, ProgressTracker pt) Parses a file and adds the parsed objects to the specified bas package. | public static Package | parse(String[] filenames, ProgressTracker pt) Create object tree from Java source inputs. | protected static void | parsePass1(Package basePackage, File[] files, ProgressTracker pt) | public static Package | parseXML(InputStream in) Create object tree from XML input, previously created from parsed .java-files. | protected static int | quoteEnd(String s, int pos, char quoteChar) | protected static String | readFile(File f) | public static String | repeat(String s, int c) Tool function: create a new String which contains s repeated c times. | public static String | replace(String s, String old, String neu) Tool function: replace any occurrence of old in s with neu. | protected static void | warning(String msg) Outputs a warning message, which is the same as outputting a log message, but is performed even is verbose==false. | protected static String | workaroundAvoidUnicodeSingleChar(String s) Replaces all occurrences of single-character-constants using unicode
with a pseudo-string. | public static String | workaroundRestoreUnicodeSingleChar(String s) Restores manipualted Java source code which avoided single-char unicode characters
back to the original code. |
documentBuilder | protected static DocumentBuilder documentBuilder(Code) | | Document builder for parsing XML.
Will be initialized when first used.
|
includeXMLDoctype | public static boolean includeXMLDoctype(Code) | | Flag specifying whether to include a DTD reference () into generated XML.
Externally set.
|
logPerformer | public static LogPerformer logPerformer(Code) | | Log performer, may be set externally.
|
validateXML | public static boolean validateXML(Code) | | Flag specifying whether to validate an XML file against its DTD before it is parsed.
Externally set.
|
verbose | public static boolean verbose(Code) | | Global verbose flag.
|
workaroundUnicodeSingleCharMarker | final protected static String workaroundUnicodeSingleCharMarker(Code) | | Constant workaroundUnicodeSingleCharMarker.
|
buildSource | public static void buildSource(Package p, File dir, File[] sources, Sourclet sourclet) throws IOException(Code) | | Output object tree of source code elements as Java source files,
applying a Sourclet for formatting the code.
Parameters: p - Package containing all other packages with classes that are to be output as formatted source code. Parameters: dir - Base directory where to output .java-files. A directory structure matching the classes' packages structure will be created. Parameters: sourclet - The Sourclet to use for formatting the output. throws: IOException - if an i/o error occurs |
buildXML | public static Document buildXML(Package p)(Code) | | Output an object tree of source code elements to XML.
Parameters: p - Package containing all other packages with classes that are to be converted to XML. The XML DOM-document. See Also: SourceParser.parseXML |
getDocumentBuilder | protected static DocumentBuilder getDocumentBuilder()(Code) | | Creates XML document builder.
|
indent | public static String indent(String s, int depth)(Code) | | Tool function: indent a multi-line string by depth blank characters in front of each line.
|
log | protected static void log(String msg)(Code) | | Outputs a log message if the verbose-flag is set..
Parameters: msg - The log message string. |
parse | public static Package parse(File[] files, ProgressTracker pt) throws IOException, ParseException(Code) | | Create object tree from Java source inputs.
Parameters: files - A list of files and/or directories. Any .java-file will be parsed, any other ignored. throws: IOException - if an i/o error occurs Root package (named "") containing all other packages with classes. |
quoteEnd | protected static int quoteEnd(String s, int pos, char quoteChar)(Code) | | |
repeat | public static String repeat(String s, int c)(Code) | | Tool function: create a new String which contains s repeated c times.
|
warning | protected static void warning(String msg)(Code) | | Outputs a warning message, which is the same as outputting a log message, but is performed even is verbose==false.
Parameters: msg - The warning message string. |
workaroundAvoidUnicodeSingleChar | protected static String workaroundAvoidUnicodeSingleChar(String s)(Code) | | Replaces all occurrences of single-character-constants using unicode
with a pseudo-string. This way, the parser does not resolve the unicode char.
This is quite an ugly workaround, but usually not too costy, as single unicode chars
are rarely used.
Parameters: s - Java source code string, maybe containg single-char unicode constants. manipulated Java source string See Also: SourceParser.workaroundRestoreUnicodeSingleChar(String) |
workaroundRestoreUnicodeSingleChar | public static String workaroundRestoreUnicodeSingleChar(String s)(Code) | | Restores manipualted Java source code which avoided single-char unicode characters
back to the original code.
Called only from Code.java.
Parameters: s - manipulated Java source string, as returned from workaroundAvoidUnicodeSingleChar() the original Java source code, as it had been passed as input to workaroundAvoidUnicodeSingleChar() See Also: SourceParser.workaroundAvoidUnicodeSingleChar(String) |
|
|