|
|
|
@ -11,6 +11,7 @@ import error from '../utils/error';
|
|
|
|
|
interface ParserOptions {
|
|
|
|
|
filename?: string;
|
|
|
|
|
bind?: boolean;
|
|
|
|
|
customElement?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ParserState = (parser: Parser) => (ParserState | void);
|
|
|
|
@ -18,6 +19,7 @@ type ParserState = (parser: Parser) => (ParserState | void);
|
|
|
|
|
export class Parser {
|
|
|
|
|
readonly template: string;
|
|
|
|
|
readonly filename?: string;
|
|
|
|
|
readonly customElement: boolean;
|
|
|
|
|
|
|
|
|
|
index: number;
|
|
|
|
|
stack: Array<Node>;
|
|
|
|
@ -36,6 +38,7 @@ export class Parser {
|
|
|
|
|
|
|
|
|
|
this.template = template.replace(/\s+$/, '');
|
|
|
|
|
this.filename = options.filename;
|
|
|
|
|
this.customElement = options.customElement;
|
|
|
|
|
|
|
|
|
|
this.allowBindings = options.bind !== false;
|
|
|
|
|
|
|
|
|
|