Package org.aspectj.org.eclipse.jdt.internal.compiler.parser

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.parser.NLSTag


      final int stringLiteralsLength = this.stringLiteralsPtr;
      final int nlsTagsLength = this.nlsTags == null ? 0 : this.nlsTags.length;
      if (stringLiteralsLength == 0) {
        if (nlsTagsLength != 0) {
          for (int i = 0; i < nlsTagsLength; i++) {
            NLSTag tag = this.nlsTags[i];
            if (tag != null) {
              scope.problemReporter().unnecessaryNLSTags(tag.start, tag.end);
            }
          }
        }
      } else if (nlsTagsLength == 0) {
        // resize string literals
        if (this.stringLiterals.length != stringLiteralsLength) {
          System.arraycopy(this.stringLiterals, 0, (stringLiterals = new StringLiteral[stringLiteralsLength]), 0, stringLiteralsLength);
        }
        Arrays.sort(this.stringLiterals, STRING_LITERAL_COMPARATOR);
        for (int i = 0; i < stringLiteralsLength; i++) {
          scope.problemReporter().nonExternalizedStringLiteral(this.stringLiterals[i]);
        }
      } else {
        // need to iterate both arrays to find non matching elements
        if (this.stringLiterals.length != stringLiteralsLength) {
          System.arraycopy(this.stringLiterals, 0, (stringLiterals = new StringLiteral[stringLiteralsLength]), 0, stringLiteralsLength);
        }
        Arrays.sort(this.stringLiterals, STRING_LITERAL_COMPARATOR);
        int indexInLine = 1;
        int lastLineNumber = -1;
        StringLiteral literal = null;
        int index = 0;
        int i = 0;
        stringLiteralsLoop: for (; i < stringLiteralsLength; i++) {
          literal = this.stringLiterals[i];
          final int literalLineNumber = literal.lineNumber;
          if (lastLineNumber != literalLineNumber) {
            indexInLine = 1;
            lastLineNumber = literalLineNumber;
          } else {
            indexInLine++;
          }
          if (index < nlsTagsLength) {
            nlsTagsLoop: for (; index < nlsTagsLength; index++) {
              NLSTag tag = this.nlsTags[index];
              if (tag == null) continue nlsTagsLoop;
              int tagLineNumber = tag.lineNumber;
              if (literalLineNumber < tagLineNumber) {
                scope.problemReporter().nonExternalizedStringLiteral(literal);
                continue stringLiteralsLoop;
              } else if (literalLineNumber == tagLineNumber) {
                if (tag.index == indexInLine) {
                  this.nlsTags[index] = null;
                  index++;
                  continue stringLiteralsLoop;
                } else {
                  nlsTagsLoop2: for (int index2 = index + 1; index2 < nlsTagsLength; index2++) {
                    NLSTag tag2 = this.nlsTags[index2];
                    if (tag2 == null) continue nlsTagsLoop2;
                    int tagLineNumber2 = tag2.lineNumber;
                    if (literalLineNumber == tagLineNumber2) {
                      if (tag2.index == indexInLine) {
                        this.nlsTags[index2] = null;
                        continue stringLiteralsLoop;
                      } else {
                        continue nlsTagsLoop2;
                      }
                    } else {
                      scope.problemReporter().nonExternalizedStringLiteral(literal);
                      continue stringLiteralsLoop;
                    }
                  }
                  scope.problemReporter().nonExternalizedStringLiteral(literal);
                  continue stringLiteralsLoop;
                }
              } else {
                scope.problemReporter().unnecessaryNLSTags(tag.start, tag.end);
                continue nlsTagsLoop;
              }
            }
          }
          // all nls tags have been processed, so remaining string literals are not externalized
          break stringLiteralsLoop;
        }
        for (; i < stringLiteralsLength; i++) {
          scope.problemReporter().nonExternalizedStringLiteral(this.stringLiterals[i]);
        }
        if (index < nlsTagsLength) {
          for (; index < nlsTagsLength; index++) {
            NLSTag tag = this.nlsTags[index];
            if (tag != null) {
              scope.problemReporter().unnecessaryNLSTags(tag.start, tag.end);
            }
          }
        }
View Full Code Here


    }
    while (pos != -1) {
      int start = pos + TAG_PREFIX_LENGTH;
      int end = CharOperation.indexOf(TAG_POSTFIX, s, start, sourceEnd);
      if (end != -1) {
        NLSTag currentTag = null;
        final int currentLine = currentLinePtr + 1;
        try {
          currentTag = new NLSTag(pos + sourceDelta, end + sourceDelta, currentLine, extractInt(s, start, end));
        } catch (NumberFormatException e) {
          currentTag = new NLSTag(pos + sourceDelta, end + sourceDelta, currentLine, -1);
        }
        if (this.nlsTagsPtr == this.nlsTags.length) {
          // resize
          System.arraycopy(this.nlsTags, 0, (this.nlsTags = new NLSTag[this.nlsTagsPtr + 10]), 0, this.nlsTagsPtr);
        }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.parser.NLSTag

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.