Package org.aspectj.org.eclipse.jdt.core.compiler

Examples of org.aspectj.org.eclipse.jdt.core.compiler.InvalidInputException


        return syntaxRecoverArgumentType(receiver, arguments, argument);
      }
    }

    // Something wrong happened => Invalid input
    throw new InvalidInputException();
  }
View Full Code Here


  final Object sourceVersion = this.options.get(CompilerOptions.OPTION_Source);
  final Object compliance = this.options.get(CompilerOptions.OPTION_Compliance);
  if (sourceVersion.equals(CompilerOptions.VERSION_1_7)
      && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) {
    // compliance must be 1.7 if source is 1.7
    throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
  } else if (sourceVersion.equals(CompilerOptions.VERSION_1_6)
      && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_6) {
    // compliance must be 1.6 if source is 1.6
    throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
  } else if (sourceVersion.equals(CompilerOptions.VERSION_1_5)
      && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_5) {
    // compliance must be 1.5 if source is 1.5
    throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
  } else if (sourceVersion.equals(CompilerOptions.VERSION_1_4)
      && CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_4) {
    // compliance must be 1.4 if source is 1.4
    throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
  }

  // check and set compliance/source/target compatibilities
  if (this.didSpecifyTarget) {
    final Object targetVersion = this.options.get(CompilerOptions.OPTION_TargetPlatform);
    // tolerate jsr14 target
    if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) {
      // expecting source >= 1.5
      if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) {
        throw new InvalidInputException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$
      }
    } else {
      // target must be 1.7 if source is 1.7
      if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7
          && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){
        throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$
      }
      // target must be 1.6 if source is 1.6
      if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6
          && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){
        throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$
      }
      // target must be 1.5 if source is 1.5
      if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5
          && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){
        throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
      }
      // target must be 1.4 if source is 1.4
      if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4
          && CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){
        throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
      }
      // target cannot be greater than compliance level
      if (CompilerOptions.versionToJdkLevel(compliance) < CompilerOptions.versionToJdkLevel(targetVersion)){
        throw new InvalidInputException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$
      }
    }
  }
}
View Full Code Here

        } else {
          this.log = new PrintWriter(new FileOutputStream(logFileName, false));
          this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$
        }
      } catch (FileNotFoundException e) {
        throw new InvalidInputException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$
      }
    }
View Full Code Here

      return TokenNameERROR;
    }
    boolean isJavaIdStart;
    if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
      if (this.complianceLevel < ClassFileConstants.JDK1_5) {
        throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
      }
      // Unicode 4 detection
      char low = (char) getNextCharWithBoundChecks();
      if (low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE) {
        // illegal low surrogate
        throw new InvalidInputException(INVALID_LOW_SURROGATE);
      }
      isJavaIdStart = ScannerHelper.isJavaIdentifierStart(c, low);
    } else if (c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE) {
      if (this.complianceLevel < ClassFileConstants.JDK1_5) {
        throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
      }
      throw new InvalidInputException(INVALID_HIGH_SURROGATE);
    } else {
      // optimized case already checked
      isJavaIdStart = Character.isJavaIdentifierStart(c);
    }
    if (isJavaIdStart)
View Full Code Here

          return TokenNameCOLON;
        case '\'' :
          {
            int test;
            if ((test = getNextChar('\n', '\r')) == 0) {
              throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
            }
            if (test > 0) {
              // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
              for (int lookAhead = 0; lookAhead < 3; lookAhead++) {
                if (this.currentPosition + lookAhead == this.eofPosition)
                  break;
                if (this.source[this.currentPosition + lookAhead] == '\n')
                  break;
                if (this.source[this.currentPosition + lookAhead] == '\'') {
                  this.currentPosition += lookAhead + 1;
                  break;
                }
              }
              throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
            }
          }
          if (getNextChar('\'')) {
            // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
            for (int lookAhead = 0; lookAhead < 3; lookAhead++) {
              if (this.currentPosition + lookAhead == this.eofPosition)
                break;
              if (this.source[this.currentPosition + lookAhead] == '\n')
                break;
              if (this.source[this.currentPosition + lookAhead] == '\'') {
                this.currentPosition += lookAhead + 1;
                break;
              }
            }
            throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
          }
          if (getNextChar('\\')) {
            if (this.unicodeAsBackSlash) {
              // consume next character
              this.unicodeAsBackSlash = false;
              if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) {
                getNextUnicodeChar();
              } else {
                if (this.withoutUnicodePtr != 0) {
                  unicodeStore();
                }
              }
            } else {
              this.currentCharacter = this.source[this.currentPosition++];
            }
            scanEscapeCharacter();
          } else { // consume next character
            this.unicodeAsBackSlash = false;
            checkIfUnicode = false;
            try {
              checkIfUnicode = ((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
              && (this.source[this.currentPosition] == 'u');
            } catch(IndexOutOfBoundsException e) {
              this.currentPosition--;
              throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
            }
            if (checkIfUnicode) {
              getNextUnicodeChar();
            } else {
              if (this.withoutUnicodePtr != 0) {
                unicodeStore();
              }
            }
          }
          if (getNextChar('\''))
            return TokenNameCharacterLiteral;
          // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
          for (int lookAhead = 0; lookAhead < 20; lookAhead++) {
            if (this.currentPosition + lookAhead == this.eofPosition)
              break;
            if (this.source[this.currentPosition + lookAhead] == '\n')
              break;
            if (this.source[this.currentPosition + lookAhead] == '\'') {
              this.currentPosition += lookAhead + 1;
              break;
            }
          }
          throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
        case '"' :
          try {
            // consume next character
            this.unicodeAsBackSlash = false;
            boolean isUnicode = false;
            if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
              && (this.source[this.currentPosition] == 'u')) {
              getNextUnicodeChar();
              isUnicode = true;
            } else {
              if (this.withoutUnicodePtr != 0) {
                unicodeStore();
              }
            }

            while (this.currentCharacter != '"') {
              /**** \r and \n are not valid in string literals ****/
              if ((this.currentCharacter == '\n') || (this.currentCharacter == '\r')) {
                // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
                if (isUnicode) {
                  int start = this.currentPosition;
                  for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
                    if (this.currentPosition >= this.eofPosition) {
                      this.currentPosition = start;
                      break;
                    }
                    if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) {
                      isUnicode = true;
                      getNextUnicodeChar();
                    } else {
                      isUnicode = false;
                    }
                    if (!isUnicode && this.currentCharacter == '\n') {
                      this.currentPosition--; // set current position on new line character
                      break;
                    }
                    if (this.currentCharacter == '\"') {
                      throw new InvalidInputException(INVALID_CHAR_IN_STRING);
                    }
                  }
                } else {
                  this.currentPosition--; // set current position on new line character
                }
                throw new InvalidInputException(INVALID_CHAR_IN_STRING);
              }
              if (this.currentCharacter == '\\') {
                if (this.unicodeAsBackSlash) {
                  this.withoutUnicodePtr--;
                  // consume next character
                  this.unicodeAsBackSlash = false;
                  if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\') && (this.source[this.currentPosition] == 'u')) {
                    getNextUnicodeChar();
                    isUnicode = true;
                    this.withoutUnicodePtr--;
                  } else {
                    isUnicode = false;
                  }
                } else {
                  if (this.withoutUnicodePtr == 0) {
                    unicodeInitializeBuffer(this.currentPosition - this.startPosition);
                  }
                  this.withoutUnicodePtr --;
                  this.currentCharacter = this.source[this.currentPosition++];
                }
                // we need to compute the escape character in a separate buffer
                scanEscapeCharacter();
                if (this.withoutUnicodePtr != 0) {
                  unicodeStore();
                }
              }
              // consume next character
              this.unicodeAsBackSlash = false;
              if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
                && (this.source[this.currentPosition] == 'u')) {
                getNextUnicodeChar();
                isUnicode = true;
              } else {
                isUnicode = false;
                if (this.withoutUnicodePtr != 0) {
                  unicodeStore();
                }
              }

            }
          } catch (IndexOutOfBoundsException e) {
            this.currentPosition--;
            throw new InvalidInputException(UNTERMINATED_STRING);
          } catch (InvalidInputException e) {
            if (e.getMessage().equals(INVALID_ESCAPE)) {
              // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
              for (int lookAhead = 0; lookAhead < 50; lookAhead++) {
                if (this.currentPosition + lookAhead == this.eofPosition)
                  break;
                if (this.source[this.currentPosition + lookAhead] == '\n')
                  break;
                if (this.source[this.currentPosition + lookAhead] == '\"') {
                  this.currentPosition += lookAhead + 1;
                  break;
                }
              }

            }
            throw e; // rethrow
          }
          return TokenNameStringLiteral;
        case '/' :
          {
            int test;
            if ((test = getNextChar('/', '*')) == 0) { //line comment
              this.lastCommentLinePosition = this.currentPosition;
              try { //get the next char
                if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
                    && (this.source[this.currentPosition] == 'u')) {
                  getNextUnicodeChar();
                }

                //handle the \\u case manually into comment
                if (this.currentCharacter == '\\') {
                  if (this.source[this.currentPosition] == '\\')
                    this.currentPosition++;
                } //jump over the \\
                boolean isUnicode = false;
                while (this.currentCharacter != '\r' && this.currentCharacter != '\n') {
                  this.lastCommentLinePosition = this.currentPosition;
                  //get the next char
                  isUnicode = false;                 
                  if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
                      && (this.source[this.currentPosition] == 'u')) {
                    getNextUnicodeChar();
                    isUnicode = true;
                  }
                  //handle the \\u case manually into comment
                  if (this.currentCharacter == '\\') {
                    if (this.source[this.currentPosition] == '\\')
                      this.currentPosition++;
                  } //jump over the \\
                }
                /*
                 * We need to completely consume the line break
                 */
                if (this.currentCharacter == '\r'
                   && this.eofPosition > this.currentPosition) {
                     if (this.source[this.currentPosition] == '\n') {
                    this.currentPosition++;
                    this.currentCharacter = '\n';
                     } else if ((this.source[this.currentPosition] == '\\')
                    && (this.source[this.currentPosition + 1] == 'u')) {
                    getNextUnicodeChar();
                    isUnicode = true;
                  }
                   }
                recordComment(TokenNameCOMMENT_LINE);
                if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
                if ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')) {
                  if (this.checkNonExternalizedStringLiterals) {
                    parseTags();
                  }
                  if (this.recordLineSeparator) {
                    if (isUnicode) {
                      pushUnicodeLineSeparator();
                    } else {
                      pushLineSeparator();
                    }
                  }
                }
                if (this.tokenizeComments) {
                  return TokenNameCOMMENT_LINE;
                }
              } catch (IndexOutOfBoundsException e) {
                this.currentPosition--;
                recordComment(TokenNameCOMMENT_LINE);
                if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
                if (this.checkNonExternalizedStringLiterals) {
                  parseTags();
                }
                if (this.tokenizeComments) {
                  return TokenNameCOMMENT_LINE;
                } else {
                  this.currentPosition++;
                }
              }
              break;
            }
            if (test > 0) { //traditional and javadoc comment
              try { //get the next char
                boolean isJavadoc = false, star = false;
                boolean isUnicode = false;
                int previous;
                // consume next character
                this.unicodeAsBackSlash = false;
                if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
                  && (this.source[this.currentPosition] == 'u')) {
                  getNextUnicodeChar();
                  isUnicode = true;
                } else {
                  isUnicode = false;
                  if (this.withoutUnicodePtr != 0) {
                    unicodeStore();
                  }
                }

                if (this.currentCharacter == '*') {
                  isJavadoc = true;
                  star = true;
                }
                if ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')) {
                  if (this.recordLineSeparator) {
                    if (isUnicode) {
                      pushUnicodeLineSeparator();
                    } else {
                      pushLineSeparator();
                    }
                  }
                }
                isUnicode = false;
                previous = this.currentPosition;
                if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
                  && (this.source[this.currentPosition] == 'u')) {
                  //-------------unicode traitement ------------
                  getNextUnicodeChar();
                  isUnicode = true;
                } else {
                  isUnicode = false;
                }
                //handle the \\u case manually into comment
                if (this.currentCharacter == '\\') {
                  if (this.source[this.currentPosition] == '\\')
                    this.currentPosition++; //jump over the \\
                }
                // empty comment is not a javadoc /**/
                if (this.currentCharacter == '/') {
                  isJavadoc = false;
                }
                //loop until end of comment */
                int firstTag = 0;
                while ((this.currentCharacter != '/') || (!star)) {
                  if ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')) {
                    if (this.recordLineSeparator) {
                      if (isUnicode) {
                        pushUnicodeLineSeparator();
                      } else {
                        pushLineSeparator();
                      }
                    }
                  }
                  switch (this.currentCharacter) {
                    case '*':
                      star = true;
                      break;
                    case '@':
                      if (firstTag == 0) {
                        firstTag = previous;
                      }
                      // fall through default case to set star to false
                    default:
                      star = false;
                  }
                  //get next char
                  previous = this.currentPosition;
                  if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
                    && (this.source[this.currentPosition] == 'u')) {
                    //-------------unicode traitement ------------
                    getNextUnicodeChar();
                    isUnicode = true;
                  } else {
                    isUnicode = false;
                  }
                  //handle the \\u case manually into comment
                  if (this.currentCharacter == '\\') {
                    if (this.source[this.currentPosition] == '\\')
                      this.currentPosition++;
                  } //jump over the \\
                }
                int token = isJavadoc ? TokenNameCOMMENT_JAVADOC : TokenNameCOMMENT_BLOCK;
                recordComment(token);
                this.commentTagStarts[this.commentPtr] = firstTag;
                if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
                if (this.tokenizeComments) {
                  /*
                  if (isJavadoc)
                    return TokenNameCOMMENT_JAVADOC;
                  return TokenNameCOMMENT_BLOCK;
                  */
                  return token;
                }
              } catch (IndexOutOfBoundsException e) {
                this.currentPosition--;
                throw new InvalidInputException(UNTERMINATED_COMMENT);
              }
              break;
            }
            if (getNextChar('='))
              return TokenNameDIVIDE_EQUAL;
            return TokenNameDIVIDE;
          }
        case '\u001a' :
          if (atEnd())
            return TokenNameEOF;
          //the atEnd may not be <currentPosition == source.length> if source is only some part of a real (external) stream
          throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
        default :
          char c = this.currentCharacter;
          if (c < ScannerHelper.MAX_OBVIOUS) {
            if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_IDENT_START) != 0) {
              return scanIdentifierOrKeyword();
            } else if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_DIGIT) != 0) {
                return scanNumber(false);
            } else {
              return TokenNameERROR;
            }
          }
          boolean isJavaIdStart;
          if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
            if (this.complianceLevel < ClassFileConstants.JDK1_5) {
              throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
            }
            // Unicode 4 detection
            char low = (char) getNextChar();
            if (low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE) {
              // illegal low surrogate
              throw new InvalidInputException(INVALID_LOW_SURROGATE);
            }
            isJavaIdStart = ScannerHelper.isJavaIdentifierStart(c, low);
          }
          else if (c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE) {
            if (this.complianceLevel < ClassFileConstants.JDK1_5) {
              throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
            }
            throw new InvalidInputException(INVALID_HIGH_SURROGATE);
          } else {
            // optimized case already checked
            isJavaIdStart = Character.isJavaIdentifierStart(c);
          }
          if (isJavaIdStart)
View Full Code Here

  if (this.currentPosition < this.eofPosition) {
    while (this.source[this.currentPosition] == 'u') {
      this.currentPosition++;
      if (this.currentPosition >= this.eofPosition) {
        this.currentPosition--;
        throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
      }
      unicodeSize++;
    }
  } else {
    this.currentPosition--;
    throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
  }

  if ((this.currentPosition + 4) > this.eofPosition) {
    this.currentPosition += (this.eofPosition - this.currentPosition);
    throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
  }
  if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
        || c1 < 0
        || (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
        || c2 < 0
        || (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
        || c3 < 0
        || (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
        || c4 < 0){
    throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
  }
  this.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
  //need the unicode buffer
  if (this.withoutUnicodePtr == 0) {
    //buffer all the entries that have been left aside....
View Full Code Here

              }
            }
            boolean isJavaIdStart;
            if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
              if (this.complianceLevel < ClassFileConstants.JDK1_5) {
                throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
              }
              // Unicode 4 detection
              char low = (char) getNextChar();
              if (low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE) {
                // illegal low surrogate
View Full Code Here

          }
        } else { // has read \OctalDigit --> ignore last character
          this.currentPosition--;
        }
        if (number > 255)
          throw new InvalidInputException(INVALID_ESCAPE);
        this.currentCharacter = (char) number;
      } else
        throw new InvalidInputException(INVALID_ESCAPE);
  }
}
View Full Code Here

      int start = this.currentPosition;
      while (getNextCharAsDigit(16)){/*empty*/}
      int end = this.currentPosition;
      if (getNextChar('l', 'L') >= 0) {
        if (end == start) {
          throw new InvalidInputException(INVALID_HEXA);
        }
        return TokenNameLongLiteral;
      } else if (getNextChar('.')) {
        if (this.sourceLevel < ClassFileConstants.JDK1_5) {
          if (end == start) {
            throw new InvalidInputException(INVALID_HEXA);
          }
          this.currentPosition = end;
          return TokenNameIntegerLiteral;
        }
        // hexadecimal floating point literal
        // read decimal part
        boolean hasNoDigitsBeforeDot = end == start;
        start = this.currentPosition;
        while (getNextCharAsDigit(16)){/*empty*/}
        end = this.currentPosition;
        if (hasNoDigitsBeforeDot && end == start) {
          throw new InvalidInputException(INVALID_HEXA);
        }
       
        if (getNextChar('p', 'P') >= 0) { // consume next character
          this.unicodeAsBackSlash = false;
          if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
            && (this.source[this.currentPosition] == 'u')) {
            getNextUnicodeChar();
          } else {
            if (this.withoutUnicodePtr != 0) {
              unicodeStore();
            }
          }

          if ((this.currentCharacter == '-')
            || (this.currentCharacter == '+')) { // consume next character
            this.unicodeAsBackSlash = false;
            if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
              && (this.source[this.currentPosition] == 'u')) {
              getNextUnicodeChar();
            } else {
              if (this.withoutUnicodePtr != 0) {
                unicodeStore();
              }
            }
          }
          if (!ScannerHelper.isDigit(this.currentCharacter)) {
            throw new InvalidInputException(INVALID_HEXA);
          }
          while (getNextCharAsDigit()){/*empty*/}
          if (getNextChar('f', 'F') >= 0) {
            return TokenNameFloatingPointLiteral;
          }
          if (getNextChar('d', 'D') >= 0) {
            return TokenNameDoubleLiteral;
          }
          if (getNextChar('l', 'L') >= 0) {
            throw new InvalidInputException(INVALID_HEXA);
          }         
          return TokenNameDoubleLiteral;
        } else {
          throw new InvalidInputException(INVALID_HEXA);
        }
      } else if (getNextChar('p', 'P') >= 0) { // consume next character
        if (this.sourceLevel < ClassFileConstants.JDK1_5) {
          // if we are in source level < 1.5 we report an integer literal
          this.currentPosition = end;
          return TokenNameIntegerLiteral;
        }
        this.unicodeAsBackSlash = false;
        if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
          && (this.source[this.currentPosition] == 'u')) {
          getNextUnicodeChar();
        } else {
          if (this.withoutUnicodePtr != 0) {
            unicodeStore();
          }
        }

        if ((this.currentCharacter == '-')
          || (this.currentCharacter == '+')) { // consume next character
          this.unicodeAsBackSlash = false;
          if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
            && (this.source[this.currentPosition] == 'u')) {
            getNextUnicodeChar();
          } else {
            if (this.withoutUnicodePtr != 0) {
              unicodeStore();
            }
          }
        }
        if (!ScannerHelper.isDigit(this.currentCharacter))
          throw new InvalidInputException(INVALID_FLOAT);
        while (getNextCharAsDigit()){/*empty*/}
        if (getNextChar('f', 'F') >= 0)
          return TokenNameFloatingPointLiteral;
        if (getNextChar('d', 'D') >= 0)
          return TokenNameDoubleLiteral;
        if (getNextChar('l', 'L') >= 0) {
          throw new InvalidInputException(INVALID_HEXA);
        }
        return TokenNameDoubleLiteral;
      } else {
        if (end == start)
          throw new InvalidInputException(INVALID_HEXA);
        return TokenNameIntegerLiteral;
      }
    }

    //there is x or X in the number
    //potential octal ! ... some one may write 000099.0 ! thus 00100 < 00078.0 is true !!!!! crazy language
    if (getNextCharAsDigit()) { //-------------potential octal-----------------
      while (getNextCharAsDigit()){/*empty*/}

      if (getNextChar('l', 'L') >= 0) {
        return TokenNameLongLiteral;
      }

      if (getNextChar('f', 'F') >= 0) {
        return TokenNameFloatingPointLiteral;
      }

      if (getNextChar('d', 'D') >= 0) {
        return TokenNameDoubleLiteral;
      } else { //make the distinction between octal and float ....
        boolean isInteger = true;
        if (getNextChar('.')) {
          isInteger = false;
          while (getNextCharAsDigit()){/*empty*/}
        }
        if (getNextChar('e', 'E') >= 0) { // consume next character
          isInteger = false;
          this.unicodeAsBackSlash = false;
          if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
            && (this.source[this.currentPosition] == 'u')) {
            getNextUnicodeChar();
          } else {
            if (this.withoutUnicodePtr != 0) {
              unicodeStore();
            }
          }

          if ((this.currentCharacter == '-')
            || (this.currentCharacter == '+')) { // consume next character
            this.unicodeAsBackSlash = false;
            if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
              && (this.source[this.currentPosition] == 'u')) {
              getNextUnicodeChar();
            } else {
              if (this.withoutUnicodePtr != 0) {
                unicodeStore();
              }
            }
          }
          if (!ScannerHelper.isDigit(this.currentCharacter))
            throw new InvalidInputException(INVALID_FLOAT);
          while (getNextCharAsDigit()){/*empty*/}
        }
        if (getNextChar('f', 'F') >= 0)
          return TokenNameFloatingPointLiteral;
        if (getNextChar('d', 'D') >= 0 || !isInteger)
          return TokenNameDoubleLiteral;
        return TokenNameIntegerLiteral;
      }
    } else {
      /* carry on */
    }
  }

  while (getNextCharAsDigit()){/*empty*/}

  if ((!dotPrefix) && (getNextChar('l', 'L') >= 0))
    return TokenNameLongLiteral;

  if ((!dotPrefix) && (getNextChar('.'))) { //decimal part that can be empty
    while (getNextCharAsDigit()){/*empty*/}
    floating = true;
  }

  //if floating is true both exponant and suffix may be optional

  if (getNextChar('e', 'E') >= 0) {
    floating = true;
    // consume next character
    this.unicodeAsBackSlash = false;
    if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
      && (this.source[this.currentPosition] == 'u')) {
      getNextUnicodeChar();
    } else {
      if (this.withoutUnicodePtr != 0) {
        unicodeStore();
      }
    }

    if ((this.currentCharacter == '-')
      || (this.currentCharacter == '+')) { // consume next character
      this.unicodeAsBackSlash = false;
      if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
        && (this.source[this.currentPosition] == 'u')) {
        getNextUnicodeChar();
      } else {
        if (this.withoutUnicodePtr != 0) {
          unicodeStore();
        }
      }
    }
    if (!ScannerHelper.isDigit(this.currentCharacter))
      throw new InvalidInputException(INVALID_FLOAT);
    while (getNextCharAsDigit()){/*empty*/}
  }

  if (getNextChar('d', 'D') >= 0)
    return TokenNameDoubleLiteral;
View Full Code Here

        break nextArg;
      }
    }

    // Something wrong happened => Invalid input
    throw new InvalidInputException();
  }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.compiler.InvalidInputException

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.