@glimmer/syntax
Version:
20 lines (19 loc) • 885 B
TypeScript
import type { Nullable } from '@glimmer/interfaces';
import type { PrecompileOptions } from '../parser/tokenizer-event-handlers';
import type { SourceLocation, SourcePosition } from './location';
import { SourceOffset, SourceSpan } from './span';
export declare class Source {
readonly source: string;
readonly module: string;
static from(source: string, options?: PrecompileOptions): Source;
constructor(source: string, module?: string);
/**
* Validate that the character offset represents a position in the source string.
*/
validate(offset: number): boolean;
slice(start: number, end: number): string;
offsetFor(line: number, column: number): SourceOffset;
spanFor({ start, end }: Readonly<SourceLocation>): SourceSpan;
hbsPosFor(offset: number): Nullable<SourcePosition>;
charPosFor(position: SourcePosition): number | null;
}