@panzer1119/bbcode-parser
Version:
BB code parser written in TypeScript.
31 lines (30 loc) • 918 B
TypeScript
import { BBTag } from "./bbtag";
export declare enum TokenType {
Text = 0,
StartTag = 1,
EndTag = 2
}
export declare class Token {
tokenType: TokenType;
content: string;
tagAttributes?: {
[key: string]: string;
} | undefined;
tagStr?: string | undefined;
constructor(tokenType: TokenType, content: string, tagAttributes?: {
[key: string]: string;
} | undefined, tagStr?: string | undefined);
toString(): string;
equals(token: Token): boolean;
}
export declare function textToken(content: string): Token;
export declare function tagToken(match: RegExpExecArray): Token;
export declare function asTextToken(token: Token): void;
export declare class Tokenizer {
private bbTags;
constructor(bbTags: {
[key: string]: BBTag;
});
tokenizeString(str: string): Token[];
getTokens(str: string): Token[];
}