Package com.google.dart.engine.scanner

Examples of com.google.dart.engine.scanner.Scanner


   * @return the first Dart token
   */
  public static com.google.dart.engine.scanner.Token scanDartSource(Source source,
      LineInfo lineInfo, String contents, int contentOffset, AnalysisErrorListener errorListener) {
    Location location = lineInfo.getLocation(contentOffset);
    Scanner scanner = new Scanner(
        source,
        new SubSequenceReader(contents, contentOffset),
        errorListener);
    scanner.setSourceStart(location.getLineNumber(), location.getColumnNumber());
    return scanner.tokenize();
  }
View Full Code Here


          closingTag,
          nodeEnd);
      String contents = tagNode.getContent();
      int contentOffset = attributeEnd.getEnd();
      Location location = lineInfo.getLocation(contentOffset);
      Scanner scanner = new Scanner(
          getSource(),
          new SubSequenceReader(contents, contentOffset),
          errorListener);
      scanner.setSourceStart(location.getLineNumber(), location.getColumnNumber());
      com.google.dart.engine.scanner.Token firstToken = scanner.tokenize();
      Parser parser = new Parser(getSource(), errorListener);
      CompilationUnit unit = parser.parseCompilationUnit(firstToken);
      unit.setLineInfo(lineInfo);
      tagNode.setScript(unit);
      return tagNode;
View Full Code Here

  @Override
  protected void internalPerform() throws AnalysisException {
    final RecordingErrorListener errorListener = new RecordingErrorListener();
    TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.start();
    try {
      Scanner scanner = new Scanner(source, new CharSequenceReader(content), errorListener);
      scanner.setPreserveComments(getContext().getAnalysisOptions().getPreserveComments());
      tokenStream = scanner.tokenize();
      lineInfo = new LineInfo(scanner.getLineStarts());
      errors = errorListener.getErrorsForSource(source);
    } catch (Exception exception) {
      throw new AnalysisException("Exception", exception);
    } finally {
      timeCounterScan.stop();
View Full Code Here

   * @param libraryFileContents the contents from the library file
   * @return the library map read from the given source
   */
  public LibraryMap readFromSource(Source source, String libraryFileContents) {
    BooleanErrorListener errorListener = new BooleanErrorListener();
    Scanner scanner = new Scanner(
        source,
        new CharSequenceReader(libraryFileContents),
        errorListener);
    Parser parser = new Parser(source, errorListener);
    CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
    LibraryBuilder libraryBuilder = new LibraryBuilder(useDart2jsPaths);
    // If any syntactic errors were found then don't try to visit the AST structure.
    if (!errorListener.getErrorReported()) {
      unit.accept(libraryBuilder);
    }
View Full Code Here

      Token syntheticToken = new SyntheticStringToken(TokenType.IDENTIFIER, "", sourceOffset);
      return new CommentReference(null, new SimpleIdentifier(syntheticToken));
    }
    try {
      BooleanErrorListener listener = new BooleanErrorListener();
      Scanner scanner = new Scanner(
          null,
          new SubSequenceReader(referenceSource, sourceOffset),
          listener);
      scanner.setSourceStart(1, 1);
      Token firstToken = scanner.tokenize();
      if (listener.getErrorReported()) {
        return null;
      }
      Token newKeyword = null;
      if (tokenMatchesKeyword(firstToken, Keyword.NEW)) {
View Full Code Here

TOP

Related Classes of com.google.dart.engine.scanner.Scanner

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.