Examples of Scanner


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

      && (level != AST.JLS3)) {
      throw new IllegalArgumentException();
    }
    this.apiLevel = level;
    // initialize a scanner
    this.scanner = new Scanner(
        true /*comment*/,
        true /*whitespace*/,
        false /*nls*/,
        ClassFileConstants.JDK1_3 /*sourceLevel*/,
        ClassFileConstants.JDK1_5 /*complianceLevel*/,
 
View Full Code Here

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

      complianceLevel = ClassFileConstants.JDK1_4;
    } else if (JavaCore.VERSION_1_5.equals(complianceLevelOption)) {
      complianceLevel = ClassFileConstants.JDK1_5;
    }
    // override scanner if 1.4 or 1.5 asked for
    this.scanner = new Scanner(
      true /*comment*/,
      true /*whitespace*/,
      false /*nls*/,
      sourceLevel /*sourceLevel*/,
      complianceLevel /*complianceLevel*/,
 
View Full Code Here

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

      supportedOnlyIn2();
    if (docComment == null) {
      throw new IllegalArgumentException();
    }
    char[] source = docComment.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) {
        switch(token) {
          case TerminalTokens.TokenNameCOMMENT_JAVADOC :
            if (onlyOneComment) {
              throw new IllegalArgumentException();
            }
View Full Code Here

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

public class InternalNamingConventions {
  private static final char[] DEFAULT_NAME = "name".toCharArray(); //$NON-NLS-1$
 
  private static Scanner getNameScanner(CompilerOptions compilerOptions) {
    return
      new Scanner(
        false /*comment*/,
        false /*whitespace*/,
        false /*nls*/,
        compilerOptions.sourceLevel /*sourceLevel*/,
        null /*taskTags*/,
View Full Code Here

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

  public void setEscapedValue(String value) {
    // check setInternalEscapedValue(String) if this method is changed
    if (value == null) {
      throw new IllegalArgumentException();
    }
    Scanner scanner = this.ast.scanner;
    char[] source = value.toCharArray();
    scanner.setSource(source);
    scanner.resetTo(0, source.length);
    try {
      int tokenType = scanner.getNextToken();
      switch(tokenType) {
        case TerminalTokens.TokenNameCharacterLiteral:
          break;
        default:
          throw new IllegalArgumentException();
View Full Code Here

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

   * @return the character value without enclosing quotes and embedded
   *    escapes
   * @exception IllegalArgumentException if the literal value cannot be converted
   */
  public char charValue() {
    Scanner scanner = this.ast.scanner;
    char[] source = escapedValue.toCharArray();
    scanner.setSource(source);
    scanner.resetTo(0, source.length);
    int firstChar = scanner.getNextChar();
    int secondChar = scanner.getNextChar();

    if (firstChar == -1 || firstChar != '\'') {
      throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
    }
    char value = (char) secondChar;
    char nextChar = (char) scanner.getNextChar();
    if (secondChar == '\\') {
      if (nextChar == -1) {
        throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
      }
      switch(nextChar) {
        case 'b' :
          value = '\b';
          break;
        case 't' :
          value = '\t';
          break;
        case 'n' :
          value = '\n';
          break;
        case 'f' :
          value = '\f';
          break;
        case 'r' :
          value = '\r';
          break;
        case '\"':
          value = '\"';
          break;
        case '\'':
          value = '\'';
          break;
        case '\\':
          value = '\\';
          break;
        default : //octal (well-formed: ended by a ' )
          try {
            if (ScannerHelper.isDigit(nextChar)) {
              int number = ScannerHelper.getNumericValue(nextChar);
              nextChar = (char) scanner.getNextChar();
              if (nextChar == -1) {
                throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
              }
              if (nextChar != '\'') {
                if (!ScannerHelper.isDigit(nextChar)) {
                  throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
                }
                number = (number * 8) + ScannerHelper.getNumericValue(nextChar);
                nextChar = (char) scanner.getNextChar();
                if (nextChar == -1) {
                  throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
                }
                if (nextChar != '\'') {
                  if (!ScannerHelper.isDigit(nextChar)) {
                    throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
                  }
                  number = (number * 8) + ScannerHelper.getNumericValue(nextChar);
                }
              }
              return (char) number;     
            } else {
              throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
            }
          } catch (InvalidInputException e) {
            throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
          }
      }
      nextChar = (char) scanner.getNextChar();
      if (nextChar == -1) {
        throw new IllegalArgumentException("illegal character literal");//$NON-NLS-1$
      }
    }
    if (nextChar == -1 || nextChar != '\'') {
View Full Code Here

Examples of org.codehaus.janino.Scanner

        final static IClassLoader CL = new ClassLoaderIClassLoader(new URLClassLoader(new URL[0]));

        public byte[] compile(final String name, final String source)
                throws Exception
        {
            Parser p = new Parser(new Scanner(name, new StringReader(source)));
            UnitCompiler uc = new UnitCompiler(p.parseCompilationUnit(), CL);
            return uc.compileUnit(DebuggingInformation.ALL)[0].toByteArray();
        }
View Full Code Here

Examples of org.codehaus.janino.Scanner

        final static IClassLoader CL = new ClassLoaderIClassLoader(new URLClassLoader(new URL[0]));

        public static byte[] compile(final String name, final String source)
                throws Exception
        {
            Parser p = new Parser(new Scanner(name, new StringReader(source)));
            UnitCompiler uc = new UnitCompiler(p.parseCompilationUnit(), CL);
            return uc.compileUnit(DebuggingInformation.ALL)[0].toByteArray();
        }
View Full Code Here

Examples of org.codehaus.plexus.util.Scanner

                log.warn("Source tree does not exist. Ignoring " + tree);
                continue;
            }
            log.debug( "Scanning source tree " + tree );

            final Scanner scanner;
            switch ( scanKind ) {

              case ADDED_OR_UPDATED:
                scanner = this.buildContext.newScanner(directory, false);
                break;

              case DELETED:
                scanner = this.buildContext.newDeleteScanner(directory);
                break;

              default:
                throw new AssertionError("Unhandled ScanKind " + scanKind);

            }


            if ( excludes != null && excludes.length > 0 ) {
                scanner.setExcludes( excludes );
            }
            scanner.addDefaultExcludes();
            scanner.setIncludes( includes );

            scanner.scan();

            for ( final String fileName : scanner.getIncludedFiles() ) {
                files.add( new Source() {

                    public File getFile() {
                        return new File(directory, fileName);
                    }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.parser.Scanner

  private TextEdit probeFormatting(String source, int indentationLevel, String lineSeparator, IRegion[] regions, boolean includeComments) {
    if (PROBING_SCANNER == null) {
      // scanner use to check if the kind could be K_JAVA_DOC, K_MULTI_LINE_COMMENT or K_SINGLE_LINE_COMMENT
      // do not tokenize white spaces to get single comments even with spaces before...
      PROBING_SCANNER = new Scanner(true, false/*do not tokenize whitespaces*/, false/*nls*/, ClassFileConstants.JDK1_6, ClassFileConstants.JDK1_6, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/);
    }
    PROBING_SCANNER.setSource(source.toCharArray());

    IRegion coveredRegion = getCoveredRegion(regions);
    int offset = coveredRegion.getOffset();
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.