Package org.eclipse.php.internal.core.util.text

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


  private int getMultiLineStatementStartOffset(int lineStart,
      int currLineIndex) {
    lineStart = IndentationUtils.moveLineStartToNonBlankChar(document,
        lineStart, currLineIndex);

    TextSequence textSequence = PHPTextSequenceUtilities
        .getStatement(lineStart,
            document.getRegionAtCharacterOffset(lineStart), true);
    int textOriginalOffset = textSequence.getOriginalOffset(0);
    int textSequenceLine = document.getLineOfOffset(textOriginalOffset);
    if (textSequence != null
        && textSequenceLine < currLineIndex
        && IndentationUtils.isRegionTypeAllowedMultiline(FormatterUtils
            .getRegionType(document, textOriginalOffset))) {
View Full Code Here


      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

    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

      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

    }
    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

  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

    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

        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

    }
    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

  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

TOP

Related Classes of org.eclipse.php.internal.core.util.text.TextSequence

Copyright © 2018 www.massapicom. 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.