/** * @license * Copyright (c) 2016 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at * http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at * http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at * http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ import { ResolvedUrl } from './url'; /** * Describes a range of text within a source file. * * NOTE: `line` and `column` Position properties are indexed from zero. Consider * displaying them to users as one-indexed numbers to match text editor * conventions. */ export interface SourceRange { readonly file: ResolvedUrl; readonly start: SourcePosition; readonly end: SourcePosition; } export interface SourcePosition { /** The line number, starting from zero. */ readonly line: number; /** The column offset within the line, starting from zero. */ readonly column: number; } export interface LocationOffset { /** Zero based line index. */ readonly line: number; /** Zero based column index. */ readonly col: number; /** * The url of the source file. */ readonly filename?: ResolvedUrl; } /** * Corrects source ranges based on an offset. * * Source ranges for inline documents need to be corrected relative to their * positions in their containing documents. * * For example, if a