Exemple #1
0
 /* (non-Javadoc)
  * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#createArgumentReference(char[], java.lang.Object, int)
  */
 protected Object createArgumentReference(
     char[] name, int dim, boolean isVarargs, Object typeRef, long[] dimPositions, long argNamePos)
     throws InvalidInputException {
   try {
     MethodRefParameter argument = this.ast.newMethodRefParameter();
     ASTNode node = (ASTNode) typeRef;
     int argStart = node.getStartPosition();
     int argEnd = node.getStartPosition() + node.getLength() - 1;
     if (dim > 0) argEnd = (int) dimPositions[dim - 1];
     if (argNamePos >= 0) argEnd = (int) argNamePos;
     if (name.length != 0) {
       final SimpleName argName = new SimpleName(this.ast);
       argName.internalSetIdentifier(new String(name));
       argument.setName(argName);
       int argNameStart = (int) (argNamePos >>> 32);
       argName.setSourceRange(argNameStart, argEnd - argNameStart + 1);
     }
     Type argType = null;
     if (node.getNodeType() == ASTNode.PRIMITIVE_TYPE) {
       argType = (PrimitiveType) node;
       //				if (dim > 0) {
       //					argType = this.ast.newArrayType(argType, dim);
       //					argType.setSourceRange(argStart, ((int) dimPositions[dim-1])-argStart+1);
       //				}
     } else {
       Name argTypeName = (Name) node;
       argType = this.ast.newSimpleType(argTypeName);
       argType.setSourceRange(argStart, node.getLength());
     }
     if (dim > 0 && !isVarargs) {
       for (int i = 0; i < dim; i++) {
         argType = this.ast.newArrayType(argType);
         argType.setSourceRange(argStart, ((int) dimPositions[i]) - argStart + 1);
       }
     }
     argument.setType(argType);
     argument.setSourceRange(argStart, argEnd - argStart + 1);
     return argument;
   } catch (ClassCastException ex) {
     throw new InvalidInputException();
   }
 }
Exemple #2
0
 /* (non-Javadoc)
  * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#refreshInlineTagPosition(int)
  */
 protected void refreshInlineTagPosition(int previousPosition) {
   if (this.astPtr != -1) {
     TagElement previousTag = (TagElement) this.astStack[this.astPtr];
     if (this.inlineTagStarted) {
       int previousStart = previousTag.getStartPosition();
       previousTag.setSourceRange(previousStart, previousPosition - previousStart + 1);
       if (previousTag.fragments().size() > 0) {
         ASTNode inlineTag =
             (ASTNode) previousTag.fragments().get(previousTag.fragments().size() - 1);
         if (inlineTag.getNodeType() == ASTNode.TAG_ELEMENT) {
           int inlineStart = inlineTag.getStartPosition();
           inlineTag.setSourceRange(inlineStart, previousPosition - inlineStart + 1);
         }
       }
     }
   }
 }
Exemple #3
0
 /* (non-Javadoc)
  * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#pushSeeRef(java.lang.Object)
  */
 protected boolean pushSeeRef(Object statement) {
   TagElement seeTag = this.ast.newTagElement();
   ASTNode node = (ASTNode) statement;
   seeTag.fragments().add(node);
   int end = node.getStartPosition() + node.getLength() - 1;
   if (this.inlineTagStarted) {
     seeTag.setSourceRange(this.inlineTagStart, end - this.inlineTagStart + 1);
     switch (this.tagValue) {
       case TAG_LINK_VALUE:
         seeTag.setTagName(TagElement.TAG_LINK);
         break;
       case TAG_LINKPLAIN_VALUE:
         seeTag.setTagName(TagElement.TAG_LINKPLAIN);
         break;
       case TAG_VALUE_VALUE:
         seeTag.setTagName(TagElement.TAG_VALUE);
         break;
     }
     TagElement previousTag = null;
     int previousStart = this.inlineTagStart;
     if (this.astPtr == -1) {
       previousTag = this.ast.newTagElement();
       pushOnAstStack(previousTag, true);
     } else {
       previousTag = (TagElement) this.astStack[this.astPtr];
       previousStart = previousTag.getStartPosition();
     }
     previousTag.fragments().add(seeTag);
     previousTag.setSourceRange(previousStart, end - previousStart + 1);
   } else {
     seeTag.setTagName(TagElement.TAG_SEE);
     seeTag.setSourceRange(this.tagSourceStart, end - this.tagSourceStart + 1);
     pushOnAstStack(seeTag, true);
   }
   return true;
 }