Link Here
|
203 |
blockDescription = description + line; |
203 |
blockDescription = description + line; |
204 |
} else { |
204 |
} else { |
205 |
description = description + line; |
205 |
description = description + line; |
|
|
206 |
String tagDescription = description.length() > 0 && description.charAt(description.length() - 1) == '\n' |
207 |
? description.substring(0, description.length() - 1) |
208 |
: description; |
206 |
PHPDocTag tag = createTag( |
209 |
PHPDocTag tag = createTag( |
207 |
startOffset + 3 + lastStartIndex, |
210 |
startOffset + 3 + lastStartIndex, |
208 |
startOffset + 3 + lastEndIndex, |
211 |
startOffset + 3 + lastEndIndex, |
209 |
lastTag, |
212 |
lastTag, |
210 |
description.substring(0, description.length() - 1), |
213 |
tagDescription, |
211 |
comment, |
214 |
comment, |
212 |
startOffset + 3); |
215 |
startOffset + 3); |
213 |
if (tag != null) { |
216 |
if (tag != null) { |
Link Here
|
228 |
PHPDocNode varibaleNode = null; |
231 |
PHPDocNode varibaleNode = null; |
229 |
if (variable != null) { |
232 |
if (variable != null) { |
230 |
int startOfVariable = findStartOfDocNode(originalComment, originalCommentStart, variable, start); |
233 |
int startOfVariable = findStartOfDocNode(originalComment, originalCommentStart, variable, start); |
231 |
varibaleNode = new PHPDocNode(startOfVariable, startOfVariable + variable.length(), variable); |
234 |
if (startOfVariable != -1) { |
|
|
235 |
varibaleNode = new PHPDocNode(startOfVariable, startOfVariable + variable.length(), variable); |
236 |
} |
232 |
} else if (type.equals(PHPDocTag.Type.PARAM)) { |
237 |
} else if (type.equals(PHPDocTag.Type.PARAM)) { |
233 |
varibaleNode = new PHPDocNode(start, start, ""); //NOI18N |
238 |
varibaleNode = new PHPDocNode(start, start, ""); //NOI18N |
234 |
} |
239 |
} |
Link Here
|
240 |
String name = getMethodName(description); |
245 |
String name = getMethodName(description); |
241 |
if (name != null) { |
246 |
if (name != null) { |
242 |
int startOfVariable = findStartOfDocNode(originalComment, originalCommentStart, name, start); |
247 |
int startOfVariable = findStartOfDocNode(originalComment, originalCommentStart, name, start); |
243 |
PHPDocNode methodNode = new PHPDocNode(startOfVariable, startOfVariable + name.length(), name); |
248 |
if (startOfVariable != -1) { |
244 |
List<PHPDocVarTypeTag> params = findMethodParams(description, findStartOfDocNode(originalComment, originalCommentStart, description, start)); |
249 |
PHPDocNode methodNode = new PHPDocNode(startOfVariable, startOfVariable + name.length(), name); |
245 |
return new PHPDocMethodTag(start, end, type, docTypes, methodNode, params, description); |
250 |
int startOfDescription = findStartOfDocNode(originalComment, originalCommentStart, description, start); |
|
|
251 |
if (startOfDescription != -1) { |
252 |
List<PHPDocVarTypeTag> params = findMethodParams(description, startOfDescription); |
253 |
return new PHPDocMethodTag(start, end, type, docTypes, methodNode, params, description); |
254 |
} |
255 |
} |
246 |
} |
256 |
} |
247 |
return null; |
257 |
return null; |
248 |
} else if (type.equals(PHPDocTag.Type.RETURN) || type.equals(PHPDocTag.Type.VAR)) { |
258 |
} else if (type.equals(PHPDocTag.Type.RETURN) || type.equals(PHPDocTag.Type.VAR)) { |
Link Here
|
272 |
for (String stype : getTypes(description, isReturnTag)) { |
282 |
for (String stype : getTypes(description, isReturnTag)) { |
273 |
stype = removeHTMLTags(stype); |
283 |
stype = removeHTMLTags(stype); |
274 |
int startDocNode = findStartOfDocNode(originalComment, originalCommentStart, stype, startDescription); |
284 |
int startDocNode = findStartOfDocNode(originalComment, originalCommentStart, stype, startDescription); |
|
|
285 |
if (startDocNode == -1) { |
286 |
continue; |
287 |
} |
275 |
int index = stype.indexOf("::"); //NOI18N |
288 |
int index = stype.indexOf("::"); //NOI18N |
276 |
boolean isArray = (stype.indexOf('[') > 0 && stype.indexOf(']') > 0); |
289 |
boolean isArray = (stype.indexOf('[') > 0 && stype.indexOf(']') > 0); |
277 |
if (isArray) { |
290 |
if (isArray) { |
Link Here
|
354 |
paramName = getVaribleName(token.trim()); |
367 |
paramName = getVaribleName(token.trim()); |
355 |
if (paramName != null) { |
368 |
if (paramName != null) { |
356 |
int startOfParamName = findStartOfDocNode(description, startOfDescription, paramName, position); |
369 |
int startOfParamName = findStartOfDocNode(description, startOfDescription, paramName, position); |
357 |
PHPDocNode paramNameNode = new PHPDocNode(startOfParamName, startOfParamName + paramName.length(), paramName); |
370 |
if (startOfParamName != -1) { |
358 |
List<PHPDocTypeNode> types = token.trim().indexOf(' ') > -1 |
371 |
PHPDocNode paramNameNode = new PHPDocNode(startOfParamName, startOfParamName + paramName.length(), paramName); |
359 |
? findTypes(token, position, description, startOfDescription) |
372 |
List<PHPDocTypeNode> types = token.trim().indexOf(' ') > -1 |
360 |
: Collections.EMPTY_LIST; |
373 |
? findTypes(token, position, description, startOfDescription) |
361 |
result.add(new PHPDocVarTypeTag(position, startOfParamName + paramName.length(), PHPDocTag.Type.PARAM, token, types, paramNameNode)); |
374 |
: Collections.EMPTY_LIST; |
|
|
375 |
result.add(new PHPDocVarTypeTag(position, startOfParamName + paramName.length(), PHPDocTag.Type.PARAM, token, types, paramNameNode)); |
376 |
} |
362 |
} |
377 |
} |
363 |
position = position + token.length() + 1; |
378 |
position = position + token.length() + 1; |
364 |
} |
379 |
} |
Link Here
|
379 |
return value; |
394 |
return value; |
380 |
} |
395 |
} |
381 |
|
396 |
|
|
|
397 |
/** |
398 |
* Find the start position of the specified string in the comment. |
399 |
* |
400 |
* @param originalComment the comment |
401 |
* @param originalStart the offset of the original comment |
402 |
* @param what the target string |
403 |
* @param from the start offset |
404 |
* @return the start position of the specified string if it is found, |
405 |
* otherwise -1. |
406 |
*/ |
382 |
private int findStartOfDocNode(String originalComment, int originalStart, String what, int from) { |
407 |
private int findStartOfDocNode(String originalComment, int originalStart, String what, int from) { |
383 |
int pos = originalComment.indexOf(what, from - originalStart); |
408 |
int pos = originalComment.indexOf(what, from - originalStart); |
384 |
return originalStart + pos; |
409 |
return pos == -1 ? pos : originalStart + pos; |
385 |
} |
410 |
} |
386 |
|
411 |
|
387 |
private String removeStarAndTrim(String text) { |
412 |
private String removeStarAndTrim(String text) { |