UNPKG

3 kBTypeScriptView Raw
1import { FilteredValueToken, TagToken, HTMLToken, HashToken, QuotedToken, LiquidTagToken, OutputToken, ValueToken, Token, RangeToken, FilterToken, TopLevelToken, OperatorToken, LiteralToken, IdentifierToken, NumberToken } from '../tokens';
2import { Trie, TokenizationError } from '../util';
3import { Operators, Expression } from '../render';
4import { NormalizedFullOptions } from '../liquid-options';
5import { FilterArg } from './filter-arg';
6export declare class Tokenizer {
7 input: string;
8 file?: string | undefined;
9 p: number;
10 N: number;
11 private rawBeginAt;
12 private opTrie;
13 private literalTrie;
14 constructor(input: string, operators?: Operators, file?: string | undefined, range?: [number, number]);
15 readExpression(): Expression;
16 readExpressionTokens(): IterableIterator<Token>;
17 readOperator(): OperatorToken | undefined;
18 matchTrie<T>(trie: Trie<T>): number;
19 readFilteredValue(): FilteredValueToken;
20 readFilters(): FilterToken[];
21 readFilter(): FilterToken | null;
22 readFilterArg(): FilterArg | undefined;
23 readTopLevelTokens(options?: NormalizedFullOptions): TopLevelToken[];
24 readTopLevelToken(options: NormalizedFullOptions): TopLevelToken;
25 readHTMLToken(stopStrings: string[]): HTMLToken;
26 readTagToken(options: NormalizedFullOptions): TagToken;
27 readToDelimiter(delimiter: string, respectQuoted?: boolean): number;
28 readOutputToken(options?: NormalizedFullOptions): OutputToken;
29 readEndrawOrRawContent(options: NormalizedFullOptions): HTMLToken | TagToken;
30 readLiquidTagTokens(options?: NormalizedFullOptions): LiquidTagToken[];
31 readLiquidTagToken(options: NormalizedFullOptions): LiquidTagToken | undefined;
32 error(msg: string, pos?: number): TokenizationError;
33 assert(pred: unknown, msg: string | (() => string), pos?: number): void;
34 snapshot(begin?: number): string;
35 /**
36 * @deprecated use #readIdentifier instead
37 */
38 readWord(): IdentifierToken;
39 readIdentifier(): IdentifierToken;
40 readNonEmptyIdentifier(): IdentifierToken | undefined;
41 readTagName(): string;
42 readHashes(jekyllStyle?: boolean | string): HashToken[];
43 readHash(jekyllStyle?: boolean | string): HashToken | undefined;
44 remaining(): string;
45 advance(step?: number): void;
46 end(): boolean;
47 read(): string;
48 readTo(end: string): number;
49 readValue(): ValueToken | undefined;
50 readScopeValue(): ValueToken | undefined;
51 private readProperties;
52 readNumber(): NumberToken | undefined;
53 readLiteral(): LiteralToken | undefined;
54 readRange(): RangeToken | undefined;
55 readValueOrThrow(): ValueToken;
56 readQuoted(): QuotedToken | undefined;
57 readFileNameTemplate(options: NormalizedFullOptions): IterableIterator<TopLevelToken>;
58 match(word: string): boolean;
59 rmatch(pattern: string): boolean;
60 peekType(n?: number): number;
61 peek(n?: number): string;
62 skipBlank(): void;
63}