55 |
|
|
56 |
int state = STATE_NORMAL; |
int state = STATE_NORMAL; |
57 |
|
|
58 |
String word = ""; |
StringBuffer word = new StringBuffer(); |
59 |
|
StringBuffer typeNameBuf = new StringBuffer(); |
60 |
int lastWordStart = startIndex; |
int lastWordStart = startIndex; |
61 |
|
int firstChar = 0; |
62 |
|
int lastChar = 0; |
63 |
for (; startIndex<endIndex; ++startIndex) { |
for (; startIndex<endIndex; ++startIndex) { |
64 |
if (state==STATE_STARC) { |
if (state==STATE_STARC) { |
65 |
if (startIndex<endIndex-1 && source[startIndex]=='*' && source[startIndex+1]=='/') { |
if (startIndex<endIndex-1 && source[startIndex]=='*' && source[startIndex+1]=='/') { |
77 |
state=STATE_STARC; |
state=STATE_STARC; |
78 |
} |
} |
79 |
else if (source[startIndex]=='=' || source[startIndex]=='(' || source[startIndex]==';') { |
else if (source[startIndex]=='=' || source[startIndex]=='(' || source[startIndex]==';') { |
80 |
|
typeName = typeNameBuf.toString(); |
81 |
return lastWordStart; |
return lastWordStart; |
82 |
} |
} |
83 |
else if (Parser.WHITESPACE.indexOf(source[startIndex])>=0) { |
else if (Parser.WHITESPACE.indexOf(source[startIndex])>=0 |
84 |
if (word.length()>0 && !word.endsWith(".")) { |
|| (startIndex > 0 && source[startIndex-1] == ']' && source[startIndex] != '[')) { |
85 |
if (processModifier(word)) { |
if (word.length()>0 && lastChar != '.') { |
86 |
|
if (processModifier(word.toString())) { |
87 |
} |
} |
88 |
else if (typeName==null && !isConstructor()) { |
else if (typeNameBuf.length()==0 && !isConstructor()) { |
89 |
typeName=word; |
typeNameBuf.setLength(0); |
90 |
|
typeNameBuf.append(word); |
91 |
} |
} |
92 |
else if ((word.startsWith("[") || word.startsWith("]")) && !isConstructor()) { |
else if ((firstChar=='[' || firstChar==']') && !isConstructor()) { |
93 |
typeName+=word; |
typeNameBuf.append(word); |
94 |
} |
} |
95 |
else { |
else { |
96 |
|
typeName = typeNameBuf.toString(); |
97 |
return lastWordStart; |
return lastWordStart; |
|
//throw new Error("In FieldComponent: cannot understand word '"+word+"' (typeName="+typeName+", name="+name()+")"); |
|
98 |
} |
} |
99 |
word=""; |
word.setLength(0); |
100 |
lastWordStart=startIndex; |
lastWordStart=startIndex; |
101 |
} |
} |
102 |
} |
} |
103 |
else { |
else { |
104 |
if (lastWordStart<0) lastWordStart=startIndex; |
if (lastWordStart<0) lastWordStart=startIndex; |
105 |
word+=source[startIndex]; |
lastChar = source[startIndex]; |
106 |
|
if (0 == word.length()) { |
107 |
|
firstChar = lastChar; |
108 |
|
} |
109 |
|
word.append((char)lastChar); |
110 |
} |
} |
111 |
} |
} |
112 |
|
|
113 |
|
typeName = typeNameBuf.toString(); |
114 |
return startIndex; |
return startIndex; |
|
|
|
115 |
} |
} |
116 |
|
|
117 |
public Type type() { |
public Type type() { |