UNPKG

885 BTypeScriptView Raw
1import type { Nullable } from '@glimmer/interfaces';
2import type { PrecompileOptions } from '../parser/tokenizer-event-handlers';
3import type { SourceLocation, SourcePosition } from './location';
4import { SourceOffset, SourceSpan } from './span';
5export declare class Source {
6 readonly source: string;
7 readonly module: string;
8 static from(source: string, options?: PrecompileOptions): Source;
9 constructor(source: string, module?: string);
10 /**
11 * Validate that the character offset represents a position in the source string.
12 */
13 validate(offset: number): boolean;
14 slice(start: number, end: number): string;
15 offsetFor(line: number, column: number): SourceOffset;
16 spanFor({ start, end }: Readonly<SourceLocation>): SourceSpan;
17 hbsPosFor(offset: number): Nullable<SourcePosition>;
18 charPosFor(position: SourcePosition): number | null;
19}