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

Examples of org.eclipse.jdt.internal.compiler.parser.Scanner.resetTo()


    int trimRightPosition = expression.sourceEnd;
    boolean first = true;
    Scanner removeBlankScanner = this.ast.scanner;
    try {
      removeBlankScanner.setSource(this.compilationUnitSource);
      removeBlankScanner.resetTo(start, end);
      while (true) {
        token = removeBlankScanner.getNextToken();
        switch (token) {
          case TerminalTokens.TokenNameCOMMENT_JAVADOC :
          case TerminalTokens.TokenNameCOMMENT_LINE :
View Full Code Here


  DOMNode first = (DOMNode) getFirstChild();
  DOMNode lastNode = null;
  // look for the open body
  Scanner scanner = new Scanner();
  scanner.setSource(this.fDocument);
  scanner.resetTo(this.fNameRange[1] + 1, this.fDocument.length);

  try {
    int currentToken = scanner.getNextToken();
    while(currentToken != TerminalTokens.TokenNameLBRACE &&
        currentToken != TerminalTokens.TokenNameEOF) {
View Full Code Here

      while (lastNode.getNextNode() != null) {
        lastNode = (DOMNode) lastNode.getNextNode();
      }
    }
    scanner.setSource(this.fDocument);
    scanner.resetTo(lastNode.getEndPosition() + 1, this.fDocument.length);
    try {
      int currentToken = scanner.getNextToken();
      while(currentToken != TerminalTokens.TokenNameRBRACE &&
          currentToken != TerminalTokens.TokenNameEOF) {
        currentToken = scanner.getNextToken();
View Full Code Here

    } catch(InvalidInputException e) {
      closeBodyStart = this.fDocument.length;
      closeBodyEnd = this.fDocument.length;
    }
  } else {
    scanner.resetTo(openBodyEnd, this.fDocument.length);
    try {
      int currentToken = scanner.getNextToken();
      while(currentToken != TerminalTokens.TokenNameRBRACE &&
          currentToken != TerminalTokens.TokenNameEOF) {
        currentToken = scanner.getNextToken();
View Full Code Here

      throw new IllegalArgumentException();
    }
    Scanner scanner = this.ast.scanner;
    char[] source = token.toCharArray();
    scanner.setSource(source);
    scanner.resetTo(0, source.length);
    scanner.tokenizeComments = false;
    scanner.tokenizeWhiteSpace = false;
    try {
      int tokenType = scanner.getNextToken();
      switch(tokenType) {
View Full Code Here

      scanner.sourceLevel = ClassFileConstants.JDK1_3;
      scanner.complianceLevel = ClassFileConstants.JDK1_5;
      char[] source = identifier.toCharArray();
      scanner.setSource(source);
      final int length = source.length;
      scanner.resetTo(0, length - 1);
      try {
        int tokenType = scanner.scanIdentifier();
        if (tokenType != TerminalTokens.TokenNameIdentifier) {
          throw new IllegalArgumentException("Invalid identifier : >" + identifier + "<")//$NON-NLS-1$//$NON-NLS-2$
        }
View Full Code Here

   */
  public void setLeadingComment(String comment) {
    if (comment != null) {
      char[] source = comment.toCharArray();
      Scanner scanner = this.ast.scanner;
      scanner.resetTo(0, source.length);
      scanner.setSource(source);
      try {
        int token;
        boolean onlyOneComment = false;
        while ((token = scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
View Full Code Here

      throw new IllegalArgumentException("Token cannot be null"); //$NON-NLS-1$
    }
    Scanner scanner = this.ast.scanner;
    char[] source = token.toCharArray();
    scanner.setSource(source);
    scanner.resetTo(0, source.length);
    try {
      int tokenType = scanner.getNextToken();
      switch(tokenType) {
        case TerminalTokens.TokenNameStringLiteral:
          break;
View Full Code Here

    }

    Scanner scanner = this.ast.scanner;
    char[] source = s.toCharArray();
    scanner.setSource(source);
    scanner.resetTo(0, source.length);
    try {
      int tokenType = scanner.getNextToken();
      switch(tokenType) {
        case TerminalTokens.TokenNameStringLiteral:
          return scanner.getCurrentStringLiteral();
View Full Code Here

    int trimRightPosition = end;
    boolean first = true;
    Scanner removeBlankScanner = this.ast.scanner;
    try {
      removeBlankScanner.setSource(this.compilationUnitSource);
      removeBlankScanner.resetTo(start, end);
      while (true) {
        token = removeBlankScanner.getNextToken();
        switch (token) {
          case TerminalTokens.TokenNameCOMMENT_JAVADOC :
          case TerminalTokens.TokenNameCOMMENT_LINE :
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.