<commit_before>// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library source_maps.source_map_span;

import 'package:source_span/source_span.dart';

/// A [SourceSpan] for spans coming from or being written to source maps.
///
/// These spans have an extra piece of metadata: whether or not they represent
/// an identifier (see [isIdentifier]).
class SourceMapSpan extends SourceSpanBase {
  /// Whether this span represents an identifier.
  ///
  /// If this is `true`, [text] is the value of the identifier.
  final bool isIdentifier;

  SourceMapSpan(SourceLocation start, SourceLocation end, String text,
          {this.isIdentifier: false})
      : super(start, end, text);

  /// Creates a [SourceMapSpan] for an identifier with value [text] starting at
  /// [start].
  ///
  /// The [end] location is determined by adding [text] to [start].
  SourceMapSpan.identifier(SourceLocation start, String text)
      : this(
          start,
          new SourceLocation(start.offset + text.length,
              sourceUrl: start.sourceUrl,
              line: start.line,
              column: start.column + text.length),
          text,
          isIdentifier: true);
}

/// A wrapper aruond a [FileSpan] that implements [SourceMapSpan].
class SourceMapFileSpan implements SourceMapSpan, FileSpan {
  final FileSpan _inner;
  final bool isIdentifier;

  SourceFile get file => _inner.file;
  FileLocation get start => _inner.start;
  FileLocation get end => _inner.end;
  String get text => _inner.text;
  String get context => _inner.context;
  Uri get sourceUrl => _inner.sourceUrl;
  int get length => _inner.length;

  SourceMapFileSpan(this._inner, {this.isIdentifier: false});

  int compareTo(SourceSpan other) => _inner.compareTo(other);
  SourceSpan union(SourceSpan other) => _inner.union(other);
  FileSpan expand(FileSpan other) => _inner.expand(other);
  String message(String message, {color}) =>
      _inner.message(message, color: color);
  String toString() => _inner.toString()
      .replaceAll("FileSpan", "SourceMapFileSpan");
}
<commit_msg>implement highlight for SourceMapFileSpan<commit_after>// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library source_maps.source_map_span;

import 'package:source_span/source_span.dart';

/// A [SourceSpan] for spans coming from or being written to source maps.
///
/// These spans have an extra piece of metadata: whether or not they represent
/// an identifier (see [isIdentifier]).
class SourceMapSpan extends SourceSpanBase {
  /// Whether this span represents an identifier.
  ///
  /// If this is `true`, [text] is the value of the identifier.
  final bool isIdentifier;

  SourceMapSpan(SourceLocation start, SourceLocation end, String text,
      {this.isIdentifier: false})
      : super(start, end, text);

  /// Creates a [SourceMapSpan] for an identifier with value [text] starting at
  /// [start].
  ///
  /// The [end] location is determined by adding [text] to [start].
  SourceMapSpan.identifier(SourceLocation start, String text)
      : this(
            start,
            new SourceLocation(start.offset + text.length,
                sourceUrl: start.sourceUrl,
                line: start.line,
                column: start.column + text.length),
            text,
            isIdentifier: true);
}

/// A wrapper aruond a [FileSpan] that implements [SourceMapSpan].
class SourceMapFileSpan implements SourceMapSpan, FileSpan {
  final FileSpan _inner;
  final bool isIdentifier;

  SourceFile get file => _inner.file;
  FileLocation get start => _inner.start;
  FileLocation get end => _inner.end;
  String get text => _inner.text;
  String get context => _inner.context;
  Uri get sourceUrl => _inner.sourceUrl;
  int get length => _inner.length;

  SourceMapFileSpan(this._inner, {this.isIdentifier: false});

  int compareTo(SourceSpan other) => _inner.compareTo(other);
  String highlight({color}) => _inner.highlight(color: color);
  SourceSpan union(SourceSpan other) => _inner.union(other);
  FileSpan expand(FileSpan other) => _inner.expand(other);
  String message(String message, {color}) =>
      _inner.message(message, color: color);
  String toString() =>
      _inner.toString().replaceAll("FileSpan", "SourceMapFileSpan");
}

{'fraction_non_alphanumeric': 0.1060341058154788, 'fraction_numerical': 0.0017490161783996502, 'mean_word_length': 3.394812680115274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1049433', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1249, 'n_words': 446}