initial vitepress site with basic nav

This commit is contained in:
mrflos 2023-05-20 19:37:42 +03:00
parent a7df2e049d
commit 2029f16583
1900 changed files with 1014692 additions and 0 deletions

4
node_modules/vscode-textmate/release/debug.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
export declare const DebugFlags: {
InDebugMode: boolean;
};
export declare const UseOnigurumaFindOptions = false;

View file

@ -0,0 +1,31 @@
import { FontStyle } from "./theme";
export declare type EncodedTokenAttributes = number;
export declare namespace EncodedTokenAttributes {
function toBinaryStr(encodedTokenAttributes: EncodedTokenAttributes): string;
function print(encodedTokenAttributes: EncodedTokenAttributes): void;
function getLanguageId(encodedTokenAttributes: EncodedTokenAttributes): number;
function getTokenType(encodedTokenAttributes: EncodedTokenAttributes): StandardTokenType;
function containsBalancedBrackets(encodedTokenAttributes: EncodedTokenAttributes): boolean;
function getFontStyle(encodedTokenAttributes: EncodedTokenAttributes): number;
function getForeground(encodedTokenAttributes: EncodedTokenAttributes): number;
function getBackground(encodedTokenAttributes: EncodedTokenAttributes): number;
/**
* Updates the fields in `metadata`.
* A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
*/
function set(encodedTokenAttributes: EncodedTokenAttributes, languageId: number, tokenType: OptionalStandardTokenType, containsBalancedBrackets: boolean | null, fontStyle: FontStyle, foreground: number, background: number): number;
}
export declare const enum StandardTokenType {
Other = 0,
Comment = 1,
String = 2,
RegEx = 3
}
export declare function toOptionalTokenType(standardType: StandardTokenType): OptionalStandardTokenType;
export declare const enum OptionalStandardTokenType {
Other = 0,
Comment = 1,
String = 2,
RegEx = 3,
NotSet = 8
}

View file

@ -0,0 +1,24 @@
import { OptionalStandardTokenType } from "../encodedTokenAttributes";
import { IEmbeddedLanguagesMap } from "../main";
import { ScopeName } from "../theme";
export declare class BasicScopeAttributes {
readonly languageId: number;
readonly tokenType: OptionalStandardTokenType;
constructor(languageId: number, tokenType: OptionalStandardTokenType);
}
export declare class BasicScopeAttributesProvider {
private readonly _defaultAttributes;
private readonly _embeddedLanguagesMatcher;
constructor(initialLanguageId: number, embeddedLanguages: IEmbeddedLanguagesMap | null);
getDefaultAttributes(): BasicScopeAttributes;
getBasicScopeAttributes(scopeName: ScopeName | null): BasicScopeAttributes;
private static readonly _NULL_SCOPE_METADATA;
private readonly _getBasicScopeAttributes;
/**
* Given a produced TM scope, return the language that token describes or null if unknown.
* e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null
*/
private _scopeToLanguage;
private _toStandardTokenType;
private static STANDARD_TOKEN_TYPE_REGEXP;
}

View file

@ -0,0 +1,198 @@
import { EncodedTokenAttributes, StandardTokenType } from '../encodedTokenAttributes';
import { IEmbeddedLanguagesMap, IGrammar, IToken, ITokenizeLineResult, ITokenizeLineResult2, ITokenTypeMap, StateStack as StackElementDef } from '../main';
import { Matcher } from '../matcher';
import { IOnigLib, OnigScanner, OnigString } from '../onigLib';
import { IRawGrammar, IRawRepository } from '../rawGrammar';
import { IRuleFactoryHelper, IRuleRegistry, Rule, RuleId } from '../rule';
import { ScopeName, ScopePath, ScopeStack, StyleAttributes } from '../theme';
import { BasicScopeAttributes } from './basicScopesAttributeProvider';
export declare function createGrammar(scopeName: ScopeName, grammar: IRawGrammar, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap | null, tokenTypes: ITokenTypeMap | null, balancedBracketSelectors: BalancedBracketSelectors | null, grammarRepository: IGrammarRepository & IThemeProvider, onigLib: IOnigLib): Grammar;
export interface IThemeProvider {
themeMatch(scopePath: ScopeStack): StyleAttributes | null;
getDefaults(): StyleAttributes;
}
export interface IGrammarRepository {
lookup(scopeName: ScopeName): IRawGrammar | undefined;
injections(scopeName: ScopeName): ScopeName[];
}
export interface Injection {
readonly debugSelector: string;
readonly matcher: Matcher<string[]>;
readonly priority: -1 | 0 | 1;
readonly ruleId: RuleId;
readonly grammar: IRawGrammar;
}
export declare class Grammar implements IGrammar, IRuleFactoryHelper, IOnigLib {
private readonly _rootScopeName;
private readonly balancedBracketSelectors;
private readonly _onigLib;
private _rootId;
private _lastRuleId;
private readonly _ruleId2desc;
private readonly _includedGrammars;
private readonly _grammarRepository;
private readonly _grammar;
private _injections;
private readonly _basicScopeAttributesProvider;
private readonly _tokenTypeMatchers;
get themeProvider(): IThemeProvider;
constructor(_rootScopeName: ScopeName, grammar: IRawGrammar, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap | null, tokenTypes: ITokenTypeMap | null, balancedBracketSelectors: BalancedBracketSelectors | null, grammarRepository: IGrammarRepository & IThemeProvider, _onigLib: IOnigLib);
dispose(): void;
createOnigScanner(sources: string[]): OnigScanner;
createOnigString(sources: string): OnigString;
getMetadataForScope(scope: string): BasicScopeAttributes;
private _collectInjections;
getInjections(): Injection[];
registerRule<T extends Rule>(factory: (id: RuleId) => T): T;
getRule(ruleId: RuleId): Rule;
getExternalGrammar(scopeName: string, repository?: IRawRepository): IRawGrammar | undefined;
tokenizeLine(lineText: string, prevState: StateStack | null, timeLimit?: number): ITokenizeLineResult;
tokenizeLine2(lineText: string, prevState: StateStack | null, timeLimit?: number): ITokenizeLineResult2;
private _tokenize;
}
export declare class AttributedScopeStack {
readonly parent: AttributedScopeStack | null;
readonly scopePath: ScopeStack;
readonly tokenAttributes: EncodedTokenAttributes;
static createRoot(scopeName: ScopeName, tokenAttributes: EncodedTokenAttributes): AttributedScopeStack;
static createRootAndLookUpScopeName(scopeName: ScopeName, tokenAttributes: EncodedTokenAttributes, grammar: Grammar): AttributedScopeStack;
get scopeName(): ScopeName;
private constructor();
equals(other: AttributedScopeStack): boolean;
private static _equals;
private static mergeAttributes;
pushAttributed(scopePath: ScopePath | null, grammar: Grammar): AttributedScopeStack;
private static _pushAttributed;
getScopeNames(): string[];
}
/**
* Represents a "pushed" state on the stack (as a linked list element).
*/
export declare class StateStack implements StackElementDef {
/**
* The previous state on the stack (or null for the root state).
*/
readonly parent: StateStack | null;
/**
* The state (rule) that this element represents.
*/
private readonly ruleId;
/**
* The state has entered and captured \n. This means that the next line should have an anchorPosition of 0.
*/
readonly beginRuleCapturedEOL: boolean;
/**
* The "pop" (end) condition for this state in case that it was dynamically generated through captured text.
*/
readonly endRule: string | null;
/**
* The list of scopes containing the "name" for this state.
*/
readonly nameScopesList: AttributedScopeStack;
/**
* The list of scopes containing the "contentName" (besides "name") for this state.
* This list **must** contain as an element `scopeName`.
*/
readonly contentNameScopesList: AttributedScopeStack;
_stackElementBrand: void;
static NULL: StateStack;
/**
* The position on the current line where this state was pushed.
* This is relevant only while tokenizing a line, to detect endless loops.
* Its value is meaningless across lines.
*/
private _enterPos;
/**
* The captured anchor position when this stack element was pushed.
* This is relevant only while tokenizing a line, to restore the anchor position when popping.
* Its value is meaningless across lines.
*/
private _anchorPos;
/**
* The depth of the stack.
*/
readonly depth: number;
constructor(
/**
* The previous state on the stack (or null for the root state).
*/
parent: StateStack | null,
/**
* The state (rule) that this element represents.
*/
ruleId: RuleId, enterPos: number, anchorPos: number,
/**
* The state has entered and captured \n. This means that the next line should have an anchorPosition of 0.
*/
beginRuleCapturedEOL: boolean,
/**
* The "pop" (end) condition for this state in case that it was dynamically generated through captured text.
*/
endRule: string | null,
/**
* The list of scopes containing the "name" for this state.
*/
nameScopesList: AttributedScopeStack,
/**
* The list of scopes containing the "contentName" (besides "name") for this state.
* This list **must** contain as an element `scopeName`.
*/
contentNameScopesList: AttributedScopeStack);
equals(other: StateStack): boolean;
private static _equals;
/**
* A structural equals check. Does not take into account `scopes`.
*/
private static _structuralEquals;
clone(): StateStack;
private static _reset;
reset(): void;
pop(): StateStack | null;
safePop(): StateStack;
push(ruleId: RuleId, enterPos: number, anchorPos: number, beginRuleCapturedEOL: boolean, endRule: string | null, nameScopesList: AttributedScopeStack, contentNameScopesList: AttributedScopeStack): StateStack;
getEnterPos(): number;
getAnchorPos(): number;
getRule(grammar: IRuleRegistry): Rule;
toString(): string;
private _writeString;
withContentNameScopesList(contentNameScopeStack: AttributedScopeStack): StateStack;
withEndRule(endRule: string): StateStack;
hasSameRuleAs(other: StateStack): boolean;
}
interface TokenTypeMatcher {
readonly matcher: Matcher<string[]>;
readonly type: StandardTokenType;
}
export declare class BalancedBracketSelectors {
private readonly balancedBracketScopes;
private readonly unbalancedBracketScopes;
private allowAny;
constructor(balancedBracketScopes: string[], unbalancedBracketScopes: string[]);
get matchesAlways(): boolean;
get matchesNever(): boolean;
match(scopes: string[]): boolean;
}
export declare class LineTokens {
private readonly balancedBracketSelectors;
private readonly _emitBinaryTokens;
/**
* defined only if `DebugFlags.InDebugMode`.
*/
private readonly _lineText;
/**
* used only if `_emitBinaryTokens` is false.
*/
private readonly _tokens;
/**
* used only if `_emitBinaryTokens` is true.
*/
private readonly _binaryTokens;
private _lastTokenEndIndex;
private readonly _tokenTypeOverrides;
constructor(emitBinaryTokens: boolean, lineText: string, tokenTypeOverrides: TokenTypeMatcher[], balancedBracketSelectors: BalancedBracketSelectors | null);
produce(stack: StateStack, endIndex: number): void;
produceFromScopes(scopesList: AttributedScopeStack, endIndex: number): void;
getResult(stack: StateStack, lineLength: number): IToken[];
getBinaryResult(stack: StateStack, lineLength: number): Uint32Array;
}
export {};

View file

@ -0,0 +1,68 @@
import { IRawRule } from '../rawGrammar';
import { ScopeName } from '../theme';
import { IGrammarRepository } from './grammar';
export declare type AbsoluteRuleReference = TopLevelRuleReference | TopLevelRepositoryRuleReference;
/**
* References the top level rule of a grammar with the given scope name.
*/
export declare class TopLevelRuleReference {
readonly scopeName: ScopeName;
constructor(scopeName: ScopeName);
toKey(): string;
}
/**
* References a rule of a grammar in the top level repository section with the given name.
*/
export declare class TopLevelRepositoryRuleReference {
readonly scopeName: ScopeName;
readonly ruleName: string;
constructor(scopeName: ScopeName, ruleName: string);
toKey(): string;
}
export declare class ExternalReferenceCollector {
private readonly _references;
private readonly _seenReferenceKeys;
get references(): readonly AbsoluteRuleReference[];
readonly visitedRule: Set<IRawRule>;
add(reference: AbsoluteRuleReference): void;
}
export declare class ScopeDependencyProcessor {
readonly repo: IGrammarRepository;
readonly initialScopeName: ScopeName;
readonly seenFullScopeRequests: Set<string>;
readonly seenPartialScopeRequests: Set<string>;
Q: AbsoluteRuleReference[];
constructor(repo: IGrammarRepository, initialScopeName: ScopeName);
processQueue(): void;
}
export declare type IncludeReference = BaseReference | SelfReference | RelativeReference | TopLevelReference | TopLevelRepositoryReference;
export declare const enum IncludeReferenceKind {
Base = 0,
Self = 1,
RelativeReference = 2,
TopLevelReference = 3,
TopLevelRepositoryReference = 4
}
export declare class BaseReference {
readonly kind = IncludeReferenceKind.Base;
}
export declare class SelfReference {
readonly kind = IncludeReferenceKind.Self;
}
export declare class RelativeReference {
readonly ruleName: string;
readonly kind = IncludeReferenceKind.RelativeReference;
constructor(ruleName: string);
}
export declare class TopLevelReference {
readonly scopeName: ScopeName;
readonly kind = IncludeReferenceKind.TopLevelReference;
constructor(scopeName: ScopeName);
}
export declare class TopLevelRepositoryReference {
readonly scopeName: ScopeName;
readonly ruleName: string;
readonly kind = IncludeReferenceKind.TopLevelRepositoryReference;
constructor(scopeName: ScopeName, ruleName: string);
}
export declare function parseInclude(include: string): IncludeReference;

View file

@ -0,0 +1 @@
export * from './grammar';

View file

@ -0,0 +1,27 @@
import type { LineTokens, StateStack } from './grammar';
import { OnigString } from '../onigLib';
import type { AttributedScopeStack, Grammar } from './grammar';
declare class TokenizeStringResult {
readonly stack: StateStack;
readonly stoppedEarly: boolean;
constructor(stack: StateStack, stoppedEarly: boolean);
}
/**
* Tokenize a string
* @param grammar
* @param lineText
* @param isFirstLine
* @param linePos
* @param stack
* @param lineTokens
* @param checkWhileConditions
* @param timeLimit Use `0` to indicate no time limit
* @returns the StackElement or StackElement.TIME_LIMIT_REACHED if the time limit has been reached
*/
export declare function _tokenizeString(grammar: Grammar, lineText: OnigString, isFirstLine: boolean, linePos: number, stack: StateStack, lineTokens: LineTokens, checkWhileConditions: boolean, timeLimit: number): TokenizeStringResult;
export declare class LocalStackElement {
readonly scopes: AttributedScopeStack;
readonly endPos: number;
constructor(scopes: AttributedScopeStack, endPos: number);
}
export {};

6
node_modules/vscode-textmate/release/json.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
export interface ILocation {
readonly filename: string | null;
readonly line: number;
readonly char: number;
}
export declare function parseJSON(source: string, filename: string | null, withMetadata: boolean): any;

141
node_modules/vscode-textmate/release/main.d.ts generated vendored Normal file
View file

@ -0,0 +1,141 @@
import { IOnigLib } from './onigLib';
import { IRawGrammar } from './rawGrammar';
import { IRawTheme, ScopeName } from './theme';
import { StandardTokenType } from './encodedTokenAttributes';
export * from './onigLib';
export { IRawTheme } from './theme';
/**
* A registry helper that can locate grammar file paths given scope names.
*/
export interface RegistryOptions {
onigLib: Promise<IOnigLib>;
theme?: IRawTheme;
colorMap?: string[];
loadGrammar(scopeName: ScopeName): Promise<IRawGrammar | undefined | null>;
getInjections?(scopeName: ScopeName): ScopeName[] | undefined;
}
/**
* A map from scope name to a language id. Please do not use language id 0.
*/
export interface IEmbeddedLanguagesMap {
[scopeName: string]: number;
}
/**
* A map from selectors to token types.
*/
export interface ITokenTypeMap {
[selector: string]: StandardTokenType;
}
export interface IGrammarConfiguration {
embeddedLanguages?: IEmbeddedLanguagesMap;
tokenTypes?: ITokenTypeMap;
balancedBracketSelectors?: string[];
unbalancedBracketSelectors?: string[];
}
/**
* The registry that will hold all grammars.
*/
export declare class Registry {
private readonly _options;
private readonly _syncRegistry;
private readonly _ensureGrammarCache;
constructor(options: RegistryOptions);
dispose(): void;
/**
* Change the theme. Once called, no previous `ruleStack` should be used anymore.
*/
setTheme(theme: IRawTheme, colorMap?: string[]): void;
/**
* Returns a lookup array for color ids.
*/
getColorMap(): string[];
/**
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
* Please do not use language id 0.
*/
loadGrammarWithEmbeddedLanguages(initialScopeName: ScopeName, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap): Promise<IGrammar | null>;
/**
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
* Please do not use language id 0.
*/
loadGrammarWithConfiguration(initialScopeName: ScopeName, initialLanguage: number, configuration: IGrammarConfiguration): Promise<IGrammar | null>;
/**
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
*/
loadGrammar(initialScopeName: ScopeName): Promise<IGrammar | null>;
private _loadGrammar;
private _loadSingleGrammar;
private _doLoadSingleGrammar;
/**
* Adds a rawGrammar.
*/
addGrammar(rawGrammar: IRawGrammar, injections?: string[], initialLanguage?: number, embeddedLanguages?: IEmbeddedLanguagesMap | null): Promise<IGrammar>;
/**
* Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.
*/
private _grammarForScopeName;
}
/**
* A grammar
*/
export interface IGrammar {
/**
* Tokenize `lineText` using previous line state `prevState`.
*/
tokenizeLine(lineText: string, prevState: StateStack | null, timeLimit?: number): ITokenizeLineResult;
/**
* Tokenize `lineText` using previous line state `prevState`.
* The result contains the tokens in binary format, resolved with the following information:
* - language
* - token type (regex, string, comment, other)
* - font style
* - foreground color
* - background color
* e.g. for getting the languageId: `(metadata & MetadataConsts.LANGUAGEID_MASK) >>> MetadataConsts.LANGUAGEID_OFFSET`
*/
tokenizeLine2(lineText: string, prevState: StateStack | null, timeLimit?: number): ITokenizeLineResult2;
}
export interface ITokenizeLineResult {
readonly tokens: IToken[];
/**
* The `prevState` to be passed on to the next line tokenization.
*/
readonly ruleStack: StateStack;
/**
* Did tokenization stop early due to reaching the time limit.
*/
readonly stoppedEarly: boolean;
}
export interface ITokenizeLineResult2 {
/**
* The tokens in binary format. Each token occupies two array indices. For token i:
* - at offset 2*i => startIndex
* - at offset 2*i + 1 => metadata
*
*/
readonly tokens: Uint32Array;
/**
* The `prevState` to be passed on to the next line tokenization.
*/
readonly ruleStack: StateStack;
/**
* Did tokenization stop early due to reaching the time limit.
*/
readonly stoppedEarly: boolean;
}
export interface IToken {
startIndex: number;
readonly endIndex: number;
readonly scopes: string[];
}
/**
* **IMPORTANT** - Immutable!
*/
export interface StateStack {
_stackElementBrand: void;
readonly depth: number;
clone(): StateStack;
equals(other: StateStack): boolean;
}
export declare const INITIAL: StateStack;
export declare const parseRawGrammar: (content: string, filePath?: string) => IRawGrammar;

2
node_modules/vscode-textmate/release/main.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
node_modules/vscode-textmate/release/main.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

8
node_modules/vscode-textmate/release/matcher.d.ts generated vendored Normal file
View file

@ -0,0 +1,8 @@
export interface MatcherWithPriority<T> {
matcher: Matcher<T>;
priority: -1 | 0 | 1;
}
export interface Matcher<T> {
(matcherInput: T): boolean;
}
export declare function createMatchers<T>(selector: string, matchesName: (names: string[], matcherInput: T) => boolean): MatcherWithPriority<T>[];

42
node_modules/vscode-textmate/release/onigLib.d.ts generated vendored Normal file
View file

@ -0,0 +1,42 @@
import { OrMask } from "./utils";
export interface IOnigLib {
createOnigScanner(sources: string[]): OnigScanner;
createOnigString(str: string): OnigString;
}
export interface IOnigCaptureIndex {
start: number;
end: number;
length: number;
}
export interface IOnigMatch {
index: number;
captureIndices: IOnigCaptureIndex[];
}
export declare const enum FindOption {
None = 0,
/**
* equivalent of ONIG_OPTION_NOT_BEGIN_STRING: (str) isn't considered as begin of string (* fail \A)
*/
NotBeginString = 1,
/**
* equivalent of ONIG_OPTION_NOT_END_STRING: (end) isn't considered as end of string (* fail \z, \Z)
*/
NotEndString = 2,
/**
* equivalent of ONIG_OPTION_NOT_BEGIN_POSITION: (start) isn't considered as start position of search (* fail \G)
*/
NotBeginPosition = 4,
/**
* used for debugging purposes.
*/
DebugCall = 8
}
export interface OnigScanner {
findNextMatchSync(string: string | OnigString, startPosition: number, options: OrMask<FindOption>): IOnigMatch | null;
dispose?(): void;
}
export interface OnigString {
readonly content: string;
dispose?(): void;
}
export declare function disposeOnigString(str: OnigString): void;

View file

@ -0,0 +1,2 @@
import { IRawGrammar } from './rawGrammar';
export declare function parseRawGrammar(content: string, filePath?: string | null): IRawGrammar;

5
node_modules/vscode-textmate/release/plist.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
export declare function parseWithLocation(content: string, filename: string | null, locationKeyName: string | null): any;
/**
* A very fast plist parser
*/
export declare function parsePLIST(content: string): any;

48
node_modules/vscode-textmate/release/rawGrammar.d.ts generated vendored Normal file
View file

@ -0,0 +1,48 @@
import { RuleId } from "./rule";
export interface ILocation {
readonly filename: string;
readonly line: number;
readonly char: number;
}
export interface ILocatable {
readonly $vscodeTextmateLocation?: ILocation;
}
export interface IRawGrammar extends ILocatable {
repository: IRawRepository;
readonly scopeName: string;
readonly patterns: IRawRule[];
readonly injections?: {
[expression: string]: IRawRule;
};
readonly injectionSelector?: string;
readonly fileTypes?: string[];
readonly name?: string;
readonly firstLineMatch?: string;
}
export interface IRawRepositoryMap {
[name: string]: IRawRule;
$self: IRawRule;
$base: IRawRule;
}
export declare type IRawRepository = IRawRepositoryMap & ILocatable;
export interface IRawRule extends ILocatable {
id?: RuleId;
readonly include?: string;
readonly name?: string;
readonly contentName?: string;
readonly match?: string;
readonly captures?: IRawCaptures;
readonly begin?: string;
readonly beginCaptures?: IRawCaptures;
readonly end?: string;
readonly endCaptures?: IRawCaptures;
readonly while?: string;
readonly whileCaptures?: IRawCaptures;
readonly patterns?: IRawRule[];
readonly repository?: IRawRepository;
readonly applyEndPatternLast?: boolean;
}
export interface IRawCapturesMap {
[captureId: string]: IRawRule;
}
export declare type IRawCaptures = IRawCapturesMap & ILocatable;

40
node_modules/vscode-textmate/release/registry.d.ts generated vendored Normal file
View file

@ -0,0 +1,40 @@
import { BalancedBracketSelectors, IGrammarRepository, IThemeProvider } from './grammar';
import { IRawGrammar } from './rawGrammar';
import { IGrammar, IEmbeddedLanguagesMap, ITokenTypeMap } from './main';
import { ScopeStack, Theme, StyleAttributes, ScopeName } from './theme';
import { IOnigLib } from './onigLib';
export declare class SyncRegistry implements IGrammarRepository, IThemeProvider {
private readonly _onigLibPromise;
private readonly _grammars;
private readonly _rawGrammars;
private readonly _injectionGrammars;
private _theme;
constructor(theme: Theme, _onigLibPromise: Promise<IOnigLib>);
dispose(): void;
setTheme(theme: Theme): void;
getColorMap(): string[];
/**
* Add `grammar` to registry and return a list of referenced scope names
*/
addGrammar(grammar: IRawGrammar, injectionScopeNames?: ScopeName[]): void;
/**
* Lookup a raw grammar.
*/
lookup(scopeName: ScopeName): IRawGrammar | undefined;
/**
* Returns the injections for the given grammar
*/
injections(targetScope: ScopeName): ScopeName[];
/**
* Get the default theme settings
*/
getDefaults(): StyleAttributes;
/**
* Match a scope in the theme.
*/
themeMatch(scopePath: ScopeStack): StyleAttributes | null;
/**
* Lookup a grammar.
*/
grammarForScopeName(scopeName: ScopeName, initialLanguage: number, embeddedLanguages: IEmbeddedLanguagesMap | null, tokenTypes: ITokenTypeMap | null, balancedBracketSelectors: BalancedBracketSelectors | null): Promise<IGrammar | null>;
}

163
node_modules/vscode-textmate/release/rule.d.ts generated vendored Normal file
View file

@ -0,0 +1,163 @@
import { OrMask } from './utils';
import { IOnigLib, IOnigCaptureIndex, FindOption, OnigString } from './onigLib';
import { ILocation, IRawGrammar, IRawRepository, IRawRule } from './rawGrammar';
declare const ruleIdSymbol: unique symbol;
export declare type RuleId = {
__brand: typeof ruleIdSymbol;
};
export declare const endRuleId = -1;
export declare const whileRuleId = -2;
export declare function ruleIdFromNumber(id: number): RuleId;
export declare function ruleIdToNumber(id: RuleId): number;
export interface IRuleRegistry {
getRule(ruleId: RuleId): Rule;
registerRule<T extends Rule>(factory: (id: RuleId) => T): T;
}
export interface IGrammarRegistry {
getExternalGrammar(scopeName: string, repository: IRawRepository): IRawGrammar | null | undefined;
}
export interface IRuleFactoryHelper extends IRuleRegistry, IGrammarRegistry {
}
export declare abstract class Rule {
readonly $location: ILocation | undefined;
readonly id: RuleId;
private readonly _nameIsCapturing;
private readonly _name;
private readonly _contentNameIsCapturing;
private readonly _contentName;
constructor($location: ILocation | undefined, id: RuleId, name: string | null | undefined, contentName: string | null | undefined);
abstract dispose(): void;
get debugName(): string;
getName(lineText: string | null, captureIndices: IOnigCaptureIndex[] | null): string | null;
getContentName(lineText: string, captureIndices: IOnigCaptureIndex[]): string | null;
abstract collectPatterns(grammar: IRuleRegistry, out: RegExpSourceList): void;
abstract compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null): CompiledRule;
abstract compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null, allowA: boolean, allowG: boolean): CompiledRule;
}
export interface ICompilePatternsResult {
readonly patterns: RuleId[];
readonly hasMissingPatterns: boolean;
}
export declare class CaptureRule extends Rule {
readonly retokenizeCapturedWithRuleId: RuleId | 0;
constructor($location: ILocation | undefined, id: RuleId, name: string | null | undefined, contentName: string | null | undefined, retokenizeCapturedWithRuleId: RuleId | 0);
dispose(): void;
collectPatterns(grammar: IRuleRegistry, out: RegExpSourceList): void;
compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule;
compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule;
}
export declare class MatchRule extends Rule {
private readonly _match;
readonly captures: (CaptureRule | null)[];
private _cachedCompiledPatterns;
constructor($location: ILocation | undefined, id: RuleId, name: string | undefined, match: string, captures: (CaptureRule | null)[]);
dispose(): void;
get debugMatchRegExp(): string;
collectPatterns(grammar: IRuleRegistry, out: RegExpSourceList): void;
compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule;
compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule;
private _getCachedCompiledPatterns;
}
export declare class IncludeOnlyRule extends Rule {
readonly hasMissingPatterns: boolean;
readonly patterns: RuleId[];
private _cachedCompiledPatterns;
constructor($location: ILocation | undefined, id: RuleId, name: string | null | undefined, contentName: string | null | undefined, patterns: ICompilePatternsResult);
dispose(): void;
collectPatterns(grammar: IRuleRegistry, out: RegExpSourceList): void;
compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule;
compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule;
private _getCachedCompiledPatterns;
}
export declare class BeginEndRule extends Rule {
private readonly _begin;
readonly beginCaptures: (CaptureRule | null)[];
private readonly _end;
readonly endHasBackReferences: boolean;
readonly endCaptures: (CaptureRule | null)[];
readonly applyEndPatternLast: boolean;
readonly hasMissingPatterns: boolean;
readonly patterns: RuleId[];
private _cachedCompiledPatterns;
constructor($location: ILocation | undefined, id: RuleId, name: string | null | undefined, contentName: string | null | undefined, begin: string, beginCaptures: (CaptureRule | null)[], end: string | undefined, endCaptures: (CaptureRule | null)[], applyEndPatternLast: boolean | undefined, patterns: ICompilePatternsResult);
dispose(): void;
get debugBeginRegExp(): string;
get debugEndRegExp(): string;
getEndWithResolvedBackReferences(lineText: string, captureIndices: IOnigCaptureIndex[]): string;
collectPatterns(grammar: IRuleRegistry, out: RegExpSourceList): void;
compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule;
compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule;
private _getCachedCompiledPatterns;
}
export declare class BeginWhileRule extends Rule {
private readonly _begin;
readonly beginCaptures: (CaptureRule | null)[];
readonly whileCaptures: (CaptureRule | null)[];
private readonly _while;
readonly whileHasBackReferences: boolean;
readonly hasMissingPatterns: boolean;
readonly patterns: RuleId[];
private _cachedCompiledPatterns;
private _cachedCompiledWhilePatterns;
constructor($location: ILocation | undefined, id: RuleId, name: string | null | undefined, contentName: string | null | undefined, begin: string, beginCaptures: (CaptureRule | null)[], _while: string, whileCaptures: (CaptureRule | null)[], patterns: ICompilePatternsResult);
dispose(): void;
get debugBeginRegExp(): string;
get debugWhileRegExp(): string;
getWhileWithResolvedBackReferences(lineText: string, captureIndices: IOnigCaptureIndex[]): string;
collectPatterns(grammar: IRuleRegistry, out: RegExpSourceList): void;
compile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string): CompiledRule;
compileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string, allowA: boolean, allowG: boolean): CompiledRule;
private _getCachedCompiledPatterns;
compileWhile(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null): CompiledRule<RuleId | typeof whileRuleId>;
compileWhileAG(grammar: IRuleRegistry & IOnigLib, endRegexSource: string | null, allowA: boolean, allowG: boolean): CompiledRule<RuleId | typeof whileRuleId>;
private _getCachedCompiledWhilePatterns;
}
export declare class RuleFactory {
static createCaptureRule(helper: IRuleFactoryHelper, $location: ILocation | undefined, name: string | null | undefined, contentName: string | null | undefined, retokenizeCapturedWithRuleId: RuleId | 0): CaptureRule;
static getCompiledRuleId(desc: IRawRule, helper: IRuleFactoryHelper, repository: IRawRepository): RuleId;
private static _compileCaptures;
private static _compilePatterns;
}
export declare class RegExpSource<TRuleId = RuleId | typeof endRuleId> {
source: string;
readonly ruleId: TRuleId;
hasAnchor: boolean;
readonly hasBackReferences: boolean;
private _anchorCache;
constructor(regExpSource: string, ruleId: TRuleId);
clone(): RegExpSource<TRuleId>;
setSource(newSource: string): void;
resolveBackReferences(lineText: string, captureIndices: IOnigCaptureIndex[]): string;
private _buildAnchorCache;
resolveAnchors(allowA: boolean, allowG: boolean): string;
}
export declare class RegExpSourceList<TRuleId = RuleId | typeof endRuleId> {
private readonly _items;
private _hasAnchors;
private _cached;
private _anchorCache;
constructor();
dispose(): void;
private _disposeCaches;
push(item: RegExpSource<TRuleId>): void;
unshift(item: RegExpSource<TRuleId>): void;
length(): number;
setSource(index: number, newSource: string): void;
compile(onigLib: IOnigLib): CompiledRule<TRuleId>;
compileAG(onigLib: IOnigLib, allowA: boolean, allowG: boolean): CompiledRule<TRuleId>;
private _resolveAnchors;
}
export declare class CompiledRule<TRuleId = RuleId | typeof endRuleId> {
private readonly regExps;
private readonly rules;
private readonly scanner;
constructor(onigLib: IOnigLib, regExps: string[], rules: TRuleId[]);
dispose(): void;
toString(): string;
findNextMatchSync(string: string | OnigString, startPosition: number, options: OrMask<FindOption>): IFindNextMatchResult<TRuleId> | null;
}
export interface IFindNextMatchResult<TRuleId = RuleId | typeof endRuleId> {
ruleId: TRuleId;
captureIndices: IOnigCaptureIndex[];
}
export {};

View file

@ -0,0 +1,5 @@
import './grammar.test';
import './json.test';
import './matcher.test';
import './themes.test';
import './tokenization.test';

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,2 @@
import { IOnigLib } from '../onigLib';
export declare function getOniguruma(): Promise<IOnigLib>;

View file

@ -0,0 +1,33 @@
import { IOnigLib } from '../onigLib';
import { RegistryOptions } from '../main';
import { IRawGrammar } from '../rawGrammar';
export interface ILanguageRegistration {
id: string;
extensions: string[];
filenames: string[];
}
export interface IGrammarRegistration {
language: string;
scopeName: string;
path: string;
embeddedLanguages: {
[scopeName: string]: string;
};
grammar?: Promise<IRawGrammar>;
}
export declare class Resolver implements RegistryOptions {
readonly language2id: {
[languages: string]: number;
};
private _lastLanguageId;
private _id2language;
private readonly _grammars;
private readonly _languages;
readonly onigLib: Promise<IOnigLib>;
constructor(grammars: IGrammarRegistration[], languages: ILanguageRegistration[], onigLibPromise: Promise<IOnigLib>);
findLanguageByExtension(fileExtension: string): string | null;
findLanguageByFilename(filename: string): string | null;
findScopeByFilename(filename: string): string | null;
findGrammarByLanguage(language: string): IGrammarRegistration;
loadGrammar(scopeName: string): Promise<IRawGrammar | null>;
}

View file

@ -0,0 +1,14 @@
import { ThemeData } from './themes.test';
import { Resolver } from './resolver';
export declare class ThemeTest {
private static _readFile;
private static _normalizeNewLines;
private readonly EXPECTED_FILE_PATH;
private readonly tests;
readonly expected: string;
readonly testName: string;
actual: string | null;
constructor(THEMES_TEST_PATH: string, testFile: string, themeDatas: ThemeData[], resolver: Resolver);
evaluate(): Promise<any>;
writeExpected(): void;
}

View file

@ -0,0 +1,6 @@
import { IGrammar } from '../main';
export interface IThemedToken {
content: string;
color: string;
}
export declare function tokenizeWithTheme(colorMap: string[], fileContents: string, grammar: IGrammar): IThemedToken[];

View file

@ -0,0 +1,7 @@
import { Registry } from '../main';
import { IRawTheme } from '../theme';
export interface ThemeData {
themeName: string;
theme: IRawTheme;
registry: Registry;
}

View file

@ -0,0 +1 @@
export {};

119
node_modules/vscode-textmate/release/theme.d.ts generated vendored Normal file
View file

@ -0,0 +1,119 @@
import { OrMask } from './utils';
export declare class Theme {
private readonly _colorMap;
private readonly _defaults;
private readonly _root;
static createFromRawTheme(source: IRawTheme | undefined, colorMap?: string[]): Theme;
static createFromParsedTheme(source: ParsedThemeRule[], colorMap?: string[]): Theme;
private readonly _cachedMatchRoot;
constructor(_colorMap: ColorMap, _defaults: StyleAttributes, _root: ThemeTrieElement);
getColorMap(): string[];
getDefaults(): StyleAttributes;
match(scopePath: ScopeStack | null): StyleAttributes | null;
}
/**
* Identifiers with a binary dot operator.
* Examples: `baz` or `foo.bar`
*/
export declare type ScopeName = string;
/**
* An expression language of ScopeNames with a binary space (to indicate nesting) operator.
* Examples: `foo.bar boo.baz`
*/
export declare type ScopePath = string;
/**
* An expression language of ScopePathStr with a binary comma (to indicate alternatives) operator.
* Examples: `foo.bar boo.baz,quick quack`
*/
export declare type ScopePattern = string;
/**
* A TextMate theme.
*/
export interface IRawTheme {
readonly name?: string;
readonly settings: IRawThemeSetting[];
}
/**
* A single theme setting.
*/
export interface IRawThemeSetting {
readonly name?: string;
readonly scope?: ScopePattern | ScopePattern[];
readonly settings: {
readonly fontStyle?: string;
readonly foreground?: string;
readonly background?: string;
};
}
export declare class ScopeStack {
readonly parent: ScopeStack | null;
readonly scopeName: ScopeName;
static from(first: ScopeName, ...segments: ScopeName[]): ScopeStack;
static from(...segments: ScopeName[]): ScopeStack | null;
constructor(parent: ScopeStack | null, scopeName: ScopeName);
push(scopeName: ScopeName): ScopeStack;
getSegments(): ScopeName[];
toString(): string;
}
export declare class StyleAttributes {
readonly fontStyle: OrMask<FontStyle>;
readonly foregroundId: number;
readonly backgroundId: number;
constructor(fontStyle: OrMask<FontStyle>, foregroundId: number, backgroundId: number);
}
/**
* Parse a raw theme into rules.
*/
export declare function parseTheme(source: IRawTheme | undefined): ParsedThemeRule[];
export declare class ParsedThemeRule {
readonly scope: ScopeName;
readonly parentScopes: ScopeName[] | null;
readonly index: number;
readonly fontStyle: OrMask<FontStyle>;
readonly foreground: string | null;
readonly background: string | null;
constructor(scope: ScopeName, parentScopes: ScopeName[] | null, index: number, fontStyle: OrMask<FontStyle>, foreground: string | null, background: string | null);
}
export declare const enum FontStyle {
NotSet = -1,
None = 0,
Italic = 1,
Bold = 2,
Underline = 4,
Strikethrough = 8
}
export declare function fontStyleToString(fontStyle: OrMask<FontStyle>): string;
export declare class ColorMap {
private readonly _isFrozen;
private _lastColorId;
private _id2color;
private _color2id;
constructor(_colorMap?: string[]);
getId(color: string | null): number;
getColorMap(): string[];
}
export declare class ThemeTrieElementRule {
scopeDepth: number;
parentScopes: ScopeName[] | null;
fontStyle: number;
foreground: number;
background: number;
constructor(scopeDepth: number, parentScopes: ScopeName[] | null, fontStyle: number, foreground: number, background: number);
clone(): ThemeTrieElementRule;
static cloneArr(arr: ThemeTrieElementRule[]): ThemeTrieElementRule[];
acceptOverwrite(scopeDepth: number, fontStyle: number, foreground: number, background: number): void;
}
export interface ITrieChildrenMap {
[segment: string]: ThemeTrieElement;
}
export declare class ThemeTrieElement {
private readonly _mainRule;
private readonly _children;
private readonly _rulesWithParentScopes;
constructor(_mainRule: ThemeTrieElementRule, rulesWithParentScopes?: ThemeTrieElementRule[], _children?: ITrieChildrenMap);
private static _sortBySpecificity;
private static _cmpBySpecificity;
match(scope: ScopeName): ThemeTrieElementRule[];
insert(scopeDepth: number, scope: ScopeName, parentScopes: ScopeName[] | null, fontStyle: number, foreground: number, background: number): void;
private _doInsertHere;
}

26
node_modules/vscode-textmate/release/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,26 @@
import { IOnigCaptureIndex } from './onigLib';
export declare function clone<T>(something: T): T;
export declare function mergeObjects(target: any, ...sources: any[]): any;
export declare function basename(path: string): string;
export declare class RegexSource {
static hasCaptures(regexSource: string | null): boolean;
static replaceCaptures(regexSource: string, captureSource: string, captureIndices: IOnigCaptureIndex[]): string;
}
/**
* A union of given const enum values.
*/
export declare type OrMask<T extends number> = number;
export declare function strcmp(a: string, b: string): number;
export declare function strArrCmp(a: string[] | null, b: string[] | null): number;
export declare function isValidHexColor(hex: string): boolean;
/**
* Escapes regular expression characters in a given string
*/
export declare function escapeRegExpCharacters(value: string): string;
export declare class CachedFn<TKey, TValue> {
private readonly fn;
private readonly cache;
constructor(fn: (key: TKey) => TValue);
get(key: TKey): TValue;
}
export declare const performanceNow: () => number;