🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

View file

@ -0,0 +1,13 @@
export declare const enum Brackets {
SquareL = 91,
SquareR = 93,
RoundL = 40,
RoundR = 41,
CurlyL = 123,
CurlyR = 125
}
export declare const bracePairs: {
91: Brackets;
40: Brackets;
123: Brackets;
};

View file

@ -0,0 +1,44 @@
import type { SyntaxType } from '../config.js';
export interface ExtractOptions {
/**
* Allow parser to look ahead of `pos` index for searching of missing
* abbreviation parts. Most editors automatically inserts closing braces for
* `[`, `{` and `(`, which will most likely be right after current caret position.
* So in order to properly expand abbreviation, user must explicitly move
* caret right after auto-inserted braces. With this option enabled, parser
* will search for closing braces right after `pos`. Default is `true`
*/
lookAhead: boolean;
/**
* Type of context syntax of expanded abbreviation.
* In 'stylesheet' syntax, brackets `[]` and `{}` are not supported thus
* not extracted.
*/
type: SyntaxType;
/**
* A string that should precede abbreviation in order to make it successfully
* extracted. If given, the abbreviation will be extracted from the nearest
* `prefix` occurrence.
*/
prefix: string;
}
export interface ExtractedAbbreviation {
/** Extracted abbreviation */
abbreviation: string;
/** Location of abbreviation in input string */
location: number;
/** Start location of matched abbreviation, including prefix */
start: number;
/** End location of extracted abbreviation */
end: number;
}
/**
* Extracts Emmet abbreviation from given string.
* The goal of this module is to extract abbreviation from current editors line,
* e.g. like this: `<span>.foo[title=bar|]</span>` -> `.foo[title=bar]`, where
* `|` is a current caret position.
* @param line A text line where abbreviation should be expanded
* @param pos Caret position in line. If not given, uses end of line
* @param options Extracting options
*/
export default function extractAbbreviation(line: string, pos?: number, options?: Partial<ExtractOptions>): ExtractedAbbreviation | undefined;

View file

@ -0,0 +1,5 @@
import { BackwardScanner } from './reader.js';
/**
* Check if given readers current position points at the end of HTML tag
*/
export default function isHtml(scanner: BackwardScanner): boolean;

View file

@ -0,0 +1,10 @@
import { BackwardScanner } from './reader.js';
/**
* Check if given character code is a quote
*/
export declare function isQuote(c?: number): boolean;
/**
* Consumes quoted value, if possible
* @return Returns `true` is value was consumed
*/
export declare function consumeQuoted(scanner: BackwardScanner): boolean;

View file

@ -0,0 +1,31 @@
type Match = ((code: number) => boolean) | number;
export interface BackwardScanner {
/** Text to scan */
text: string;
/** Left bound till given text must be scanned */
start: number;
/** Current scanner position */
pos: number;
}
/**
* Creates structure for scanning given string in backward direction
*/
export default function backwardScanner(text: string, start?: number): BackwardScanner;
/**
* Check if given scanner position is at start of scanned text
*/
export declare function sol(scanner: BackwardScanner): boolean;
/**
* Peeks character code an current scanner location without advancing it
*/
export declare function peek(scanner: BackwardScanner, offset?: number): number;
/**
* Returns current character code and moves character location one symbol back
*/
export declare function previous(scanner: BackwardScanner): number | undefined;
/**
* Consumes current character code if it matches given `match` code or function
*/
export declare function consume(scanner: BackwardScanner, match: Match): boolean;
export declare function consumeWhile(scanner: BackwardScanner, match: Match): boolean;
export {};