Examples of TextSequence


Examples of org.eclipse.php.internal.core.util.text.TextSequence

      Set<IType> returnTypes = new LinkedHashSet<IType>();
      if (functionNameStart == functionNameEnd
          && statementText.charAt(functionNameStart) == '('
          && propertyEndPosition - 1 > functionNameStart + 1
          && phpVersion.isGreaterThan(PHPVersion.PHP5_3)) {
        TextSequence newClassStatementText = statementText
            .subTextSequence(functionNameStart + 1,
                propertyEndPosition - 1);
        String newClassName = PHPModelUtils
            .getClassNameForNewStatement(newClassStatementText,
                phpVersion);
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

    int elementStart = getElementStart();
    int lhsIndex = elementStart - "parent".length() //$NON-NLS-1$
        - getTriggerType().getName().length();
    if (lhsIndex >= 0) {
      TextSequence statementText = getStatementText();
      String parentText = statementText.subSequence(lhsIndex,
          elementStart - getTriggerType().getName().length())
          .toString();

      if (parentText.equals("parent") || (PHPVersion.PHP5_4.isLessThan(phpVersion) && parentText.toLowerCase().equals("parent"))) { //$NON-NLS-1$ //$NON-NLS-2$
        isParent = isDirectParent = true;
      }
    }

    lhsIndex = elementStart - "self".length() //$NON-NLS-1$
        - getTriggerType().getName().length();
    if (lhsIndex >= 0) {
      TextSequence statementText = getStatementText();
      String parentText = statementText.subSequence(lhsIndex,
          elementStart - getTriggerType().getName().length())
          .toString();
      if (parentText.equals("self") || (PHPVersion.PHP5_4.isLessThan(phpVersion) && parentText.toLowerCase().equals("self"))) { //$NON-NLS-1$ //$NON-NLS-2$
        isSelf = isDirectSelf = true;
      }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

      CompletionRequestor requestor) {
    if (!super.isValid(sourceModule, offset, requestor)) {
      return false;
    }

    TextSequence statementText = getStatementText();
    typeEnd = PHPTextSequenceUtilities.isInClassDeclaration(statementText);
    if (typeEnd == -1) {
      return false;
    }

    // check if we are in the class identifier part.
    typeIdentifierEnd = 0;
    for (; typeIdentifierEnd < statementText.length(); typeIdentifierEnd++) {
      if (!Character.isLetterOrDigit(statementText
          .charAt(typeIdentifierEnd))) {
        break;
      }
    }
    // we are in class identifier part.
    if (typeIdentifierEnd == statementText.length()) {
      return true;
    }

    extendsMatcher = EXTENDS_PATTERN.matcher(statementText);
    hasExtends = extendsMatcher.find();
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

    }
    String tagName = getTagName();
    if (!getTags().contains(tagName)) {
      return false;
    }
    TextSequence statementText = getStatementText();
    String statementTextString = statementText.toString();
    StringTokenizer st = new StringTokenizer(statementTextString);
    Stack<String> stack = new Stack<String>();
    while (st.hasMoreElements()) {
      stack.add((String) st.nextElement());
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

  public boolean isValid(ISourceModule sourceModule, int offset,
      CompletionRequestor requestor) {
    if (!super.isValid(sourceModule, offset, requestor)) {
      return false;
    }
    TextSequence statementText = getStatementText();
    Matcher matcher = CATCH_PATTERN.matcher(statementText);
    catchStart = statementText.length();
    while (matcher.find()) {
      if (statementText.length() == matcher.end()) {
        catchStart = matcher.start() + 1; // for the white space before
                          // the 'class'
        break;
      }
    }
    if (catchStart == statementText.length()) {
      return false;
    }
    return true;
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

    if (!super.isValid(sourceModule, offset, requestor)) {
      return false;
    }
    int typeEnd = getTypeEnd();
    if (typeEnd >= 10) {
      TextSequence statementText = getStatementText();
      String typeString = statementText.subSequence(typeEnd - 10,
          typeEnd - 1).toString();
      if ("interface".equals(typeString)) { //$NON-NLS-1$
        return true;
      }
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

        try {
          String prefix = getPrefix();
          if ((prefix == null || prefix.length() == 0)) {
            return false;
          }
          TextSequence statementText = getStatementText();
          if (statementText.length() > 0
              && statementText.charAt(statementText.length() - 1) == ':') {
            return false;
          }
        } catch (BadLocationException e) {
        }
      }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

    }
    String tagName = getTagName();
    if (!getTags().contains(tagName)) {
      return false;
    }
    TextSequence statementText = getStatementText();
    String statementTextString = statementText.toString();
    StringTokenizer st = new StringTokenizer(statementTextString);
    Stack<String> stack = new Stack<String>();
    while (st.hasMoreElements()) {
      stack.add((String) st.nextElement());
    }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

  public String getPrefix() throws BadLocationException {
    if (hasWhitespaceBeforeCursor()) {
      return ""; //$NON-NLS-1$
    }
    TextSequence statementText = getStatementText();
    int statementLength = statementText.length();
    int prefixEnd = PHPTextSequenceUtilities.readBackwardSpaces(
        statementText, statementLength); // read whitespace
    int prefixStart = PHPTextSequenceUtilities.readIdentifierStartIndex(
        statementText, prefixEnd, true);
    return statementText.subSequence(prefixStart, prefixEnd).toString();
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.util.text.TextSequence

    if (!super.isValid(sourceModule, offset, requestor)) {
      return false;
    }

    int classEnd = getCatchStart() + 5; // "catch"
    TextSequence statementText = getStatementText();
    statementText = statementText.subTextSequence(classEnd, statementText
        .length());

    int startPosition = 0;
    for (; startPosition < statementText.length(); startPosition++) {
      if (statementText.charAt(startPosition) == '(') {
        break;
      }
    }
    if (startPosition == statementText.length()) {
      // the current position is before the '('
      return false;
    }

    startPosition = PHPTextSequenceUtilities.readForwardSpaces(
        statementText, startPosition + 1); // + 1 for the '('
    int endPosition = PHPTextSequenceUtilities.readIdentifierEndIndex(
        getPhpVersion(), statementText, startPosition, false);
    // String className = statementText.subSequence(startPosition,
    // endPosition).toString();

    if (endPosition != statementText.length()) {
      return false;
    }
    return true;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.