To fetch syntax info directly from source string representation.
Quicker than javaCC, used for edit and completion purposes.
Other advantage: parses locally, also when not globally valid.
getJavaIdentifierBefore(SimpleDocument doc, int pos, String prepend) Takes greedilly a full java identifier before the position given.
Used from document filter when "." is pressed somewhere for completion purposes.
Quick and not requiring a compilable state...
xxx.
makeAllJavaNamesSimpleInText(String signature) java.lang.String hello(myApp.XYZ var) => String hello(XYZ var)
NOT ROBUST:
=> only simplify if the guessed package name is lowercase.
removeAllArrayPartsAtEnd(String id) Removes all array [] elements at the end, including content
internal: remove everything after the first "[" occurence.
public static String convertVmNameToFullJavaNames(String className)(Code)
[I => int[] (defined in Class.getName()). Names are NOT also in simple form.
Used in the decompiledClass to match javap signatures !
Also used in JMapReader and JavaDocParser.
countLinesUpToPosition
public static int countLinesUpToPosition(String txt, int pos)(Code)
0 if the pos is on the first line.Just count the return backslash + n, ignore CRs
Takes greedilly a full java identifier before the position given.
Used from document filter when "." is pressed somewhere for completion purposes.
Quick and not requiring a compilable state...
xxx. yyy.zzz => "xxx.yyy.zzz";
xxx. yy y.zzz => "y.zzz";
xxx.yyy(12.32, z())[8].zzz => xxx.yyy()[].zzz
casts are reduced
((Double) xxx).doubleValue() => {C:Double}.doubleValue()
type variable also
Vector => Vector{TV:Double}
Don't look at Character.isJavaIdentifierStart() limitations.
Not very exact, somehow tolerant...
the identifier, without spaces.TODO2: count args at level -1 of parenthesis (number of ",") , allow [ ] in argsApril2007: skip (ignore( the type params as in Vector
public static boolean isPrimitiveType(String w)(Code)
if one of [boolean, float, ..., void]
isValidIdentifier
public static boolean isValidIdentifier(String id)(Code)
a.b.d is valid, 12.43 not.
keywords are not allowed, names starting with bad letter also not.
(JFrame) as simplified cast form of ((JFrame) aa) is allowed
public static String makeAllJavaNamesSimpleInText(String signature)(Code)
java.lang.String hello(myApp.XYZ var) => String hello(XYZ var)
NOT ROBUST:
=> only simplify if the guessed package name is lowercase.
=> static method calls like String.hello remains unchanged
Used in javadoc completion.
[0]: the return type [1]: the arguments names list (ONLY MADE) [2]: the throws listthis must be called from within a comment