Examples of IScanner


Examples of org.eclipse.jdt.core.compiler.IScanner

          ctx.setHasHeaderComment();
        }
      }

      final int shift = range.getOffset();
      IScanner scanner = ctx.getScanner();
      scanner.resetTo(shift, shift + range.getLength());

      int start = shift;
      while (true) {

        int token = scanner.getNextToken();
        start = scanner.getCurrentTokenStartPosition();

        switch (token) {
        case ITerminalSymbols.TokenNameCOMMENT_JAVADOC:
        case ITerminalSymbols.TokenNameCOMMENT_BLOCK: {
          int end = scanner.getCurrentTokenEndPosition() + 1;
          regions.add(new Region(start, end - start));
          continue;
        }
        case ITerminalSymbols.TokenNameCOMMENT_LINE:
          continue;
View Full Code Here

Examples of org.eclipse.jdt.core.compiler.IScanner

     * scan the header content up to the first type. Once a comment is
     * found, accumulate any additional comments up to the stop condition.
     * The stop condition is reaching a package declaration, import container,
     * or the end of the input.
     */
    IScanner scanner = ctx.getScanner();
    scanner.resetTo(start, end);

    int headerStart = -1;
    int headerEnd = -1;
    try {
      boolean foundComment = false;
      int terminal = scanner.getNextToken();
      while (terminal != ITerminalSymbols.TokenNameEOF
          &&
          !(terminal == ITerminalSymbols.TokenNameclass ||
              terminal == ITerminalSymbols.TokenNameinterface ||
              terminal == ITerminalSymbols.TokenNameenum || (foundComment && (terminal == ITerminalSymbols.TokenNameimport || terminal == ITerminalSymbols.TokenNamepackage)))) {

        if (terminal == ITerminalSymbols.TokenNameCOMMENT_JAVADOC ||
            terminal == ITerminalSymbols.TokenNameCOMMENT_BLOCK ||
            terminal == ITerminalSymbols.TokenNameCOMMENT_LINE) {
          if (!foundComment)
            headerStart = scanner.getCurrentTokenStartPosition();
          headerEnd = scanner.getCurrentTokenEndPosition();
          foundComment = true;
        }
        terminal = scanner.getNextToken();
      }

    }
    catch (InvalidInputException ex) {
      return null;
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.