org.tromer.jie
Class Syntax

java.lang.Object
  |
  +--org.tromer.jie.Syntax

public class Syntax
extends java.lang.Object

Utility functions for handling of Java syntax.


Constructor Summary
Syntax()
           
 
Method Summary
static java.lang.String cleanIdentifier(java.lang.String in)
          Remove whitespace and ignorable character from string.
static byte compareCodeLocations(java.awt.Point a, java.awt.Point b)
          Returns 1 is 'a' comes after b, -1 if 'a' comes before 'b', and 0 if 'a' equals 'b'.
static java.lang.String dumpToString(Node root)
          Returns a dump of the AST tree branch, without special tokens removed.
static void fillInNodeDFSIndices(CompilationUnit root)
          Fills in the previsitIndex and postvisitIndex fields of all the nodes in the AST.
static void fillInNodePositions(CompilationUnit root)
          Fills in the textual position fields of all the nodes in the AST.
static java.lang.String getIdentFromName(java.lang.String name)
          Returns the last identifier in a Java name.
static int lastIndexOfNewline(java.lang.String s, int end)
          Similar to s.lastIndexOf('\n', int), but handles all possible newlines combinations (CR, LF, CRLF).
static java.lang.String normalizeArrayDimsAndInits(ArrayDimsAndInits n)
          Returns the normalized form of an ArrayDimsAndInits, consisting of square brackets only.
static java.lang.String normalizeWhitespace(java.lang.String in)
          Convert each sequence of whitespace characters to a single space.
static int numOfNewlines(java.lang.String s)
          Returns the number of newlines in a string, taking into account all possible combinations (CR, LF, CRLF).
static java.lang.String zeroLiteralForType(java.lang.String type)
          Returns the literal value for zero ("false", "0" or "null") for the specified type.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Syntax

public Syntax()
Method Detail

getIdentFromName

public static java.lang.String getIdentFromName(java.lang.String name)
Returns the last identifier in a Java name.

cleanIdentifier

public static java.lang.String cleanIdentifier(java.lang.String in)
Remove whitespace and ignorable character from string.

normalizeWhitespace

public static java.lang.String normalizeWhitespace(java.lang.String in)
Convert each sequence of whitespace characters to a single space. Does not trim space at beginning or end of string.

dumpToString

public static java.lang.String dumpToString(Node root)
Returns a dump of the AST tree branch, without special tokens removed.

zeroLiteralForType

public static java.lang.String zeroLiteralForType(java.lang.String type)
Returns the literal value for zero ("false", "0" or "null") for the specified type.

lastIndexOfNewline

public static int lastIndexOfNewline(java.lang.String s,
                                     int end)
Similar to s.lastIndexOf('\n', int), but handles all possible newlines combinations (CR, LF, CRLF).

numOfNewlines

public static int numOfNewlines(java.lang.String s)
Returns the number of newlines in a string, taking into account all possible combinations (CR, LF, CRLF).

normalizeArrayDimsAndInits

public static java.lang.String normalizeArrayDimsAndInits(ArrayDimsAndInits n)
Returns the normalized form of an ArrayDimsAndInits, consisting of square brackets only.

compareCodeLocations

public static byte compareCodeLocations(java.awt.Point a,
                                        java.awt.Point b)
Returns 1 is 'a' comes after b, -1 if 'a' comes before 'b', and 0 if 'a' equals 'b'.

fillInNodePositions

public static void fillInNodePositions(CompilationUnit root)
Fills in the textual position fields of all the nodes in the AST.

fillInNodeDFSIndices

public static void fillInNodeDFSIndices(CompilationUnit root)
Fills in the previsitIndex and postvisitIndex fields of all the nodes in the AST.