01: package tide.utils;
02:
03: import java.util.Map;
04:
05: //import tide.classsyntax.IDChain;
06:
07: /** Represents a parsed ID (expression) from a document position (before).
08: * used for completion when ".", or "(" are pressed.
09: * Also look what preceeds "(" or "new" or "import"
10: * allowing a later chain analysis with IDChain
11: * includes arrays, casts and type variables.
12: *
13: * TODO: more rubust analysis !! (maybe really parsed using a grammar...)
14: */
15: public final class ParsedID {
16: //"a.b.c.xxx[]", "this"
17: public final String identifierChain;
18: // "[" or "(" or "new" or "import"...
19: public final String precedingItem;
20: // for example "("
21: // completion mode, not used cause we know what the user pressed, "." or "(" , editor locator: used
22: public final String followingItem;
23: public final int startPositionInDocument;
24: // the preparsed chain has {C:n} replacements for casts. This maps {n, type name}
25: public final Map<String, String> castsReplacements,
26: typeVariablesReplacements;
27:
28: /**
29: */
30: public ParsedID(String identifierChain, String precedingItem,
31: String followingItem, int startPositionInDocument,
32: Map<String, String> castsReplacements,
33: Map<String, String> typeVariablesReplacements) {
34: this .identifierChain = identifierChain;
35: this .precedingItem = precedingItem;
36: this .followingItem = followingItem;
37: this .startPositionInDocument = startPositionInDocument;
38: this .castsReplacements = castsReplacements;
39: this .typeVariablesReplacements = typeVariablesReplacements;
40: }
41:
42: @Override
43: public String toString() {
44: return "ParsedID: \"" + identifierChain + "\"\n prec: "
45: + precedingItem + ", next: " + followingItem;
46: }
47:
48: }
|