UNPKG

1.64 kBTypeScriptView Raw
1import { EntityParser, Token, TokenizerDelegate, TokenMap, TokenType, TokenizerOptions } from './types';
2export default class Tokenizer implements TokenizerDelegate {
3 private options;
4 private token;
5 private startLine;
6 private startColumn;
7 private tokenizer;
8 private tokens;
9 private _currentAttribute?;
10 constructor(entityParser: EntityParser, options?: TokenizerOptions);
11 tokenize(input: string): Token[];
12 tokenizePart(input: string): Token[];
13 tokenizeEOF(): Token;
14 reset(): void;
15 current<T extends TokenType, U extends TokenType>(type1: T, type2: U): TokenMap[T] | TokenMap[U];
16 current<T extends TokenType>(type: T): TokenMap[T];
17 current(): Token;
18 push(token: Token): void;
19 currentAttribute(): [string, string, boolean] | undefined;
20 addLocInfo(): void;
21 beginDoctype(): void;
22 appendToDoctypeName(char: string): void;
23 appendToDoctypePublicIdentifier(char: string): void;
24 appendToDoctypeSystemIdentifier(char: string): void;
25 endDoctype(): void;
26 beginData(): void;
27 appendToData(char: string): void;
28 finishData(): void;
29 beginComment(): void;
30 appendToCommentData(char: string): void;
31 finishComment(): void;
32 tagOpen(): void;
33 beginStartTag(): void;
34 beginEndTag(): void;
35 finishTag(): void;
36 markTagAsSelfClosing(): void;
37 appendToTagName(char: string): void;
38 beginAttribute(): void;
39 appendToAttributeName(char: string): void;
40 beginAttributeValue(isQuoted: boolean): void;
41 appendToAttributeValue(char: string): void;
42 finishAttributeValue(): void;
43 reportSyntaxError(message: string): void;
44}