File size: 863 Bytes
68d7816 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation';
export interface BashSyntaxNode {
readonly type: string;
readonly text: string;
readonly startIndex: number;
readonly endIndex: number;
readonly isNamed: boolean;
readonly children: readonly BashSyntaxNode[];
}
export interface BashParseOptions {
readonly timeoutMs?: number;
readonly maxNodes?: number;
}
export type BashParseResult =
| { readonly ok: true; readonly hasError: boolean; readonly root: BashSyntaxNode }
| { readonly ok: false; readonly reason: 'aborted' };
export interface IBashParserService {
readonly _serviceBrand: undefined;
parse(source: string, options?: BashParseOptions): BashParseResult;
}
export const IBashParserService: ServiceIdentifier<IBashParserService> =
createDecorator<IBashParserService>('bashParserService');
|