Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function tokenize(input: string) {
var tokenizer = new EventedTokenizer(
delegate,
new EntityParser(HTML5NamedCharRefs)
);
tokenizer.tokenize(input);
}
export function Parser(source, options) {
this.options = options || {};
this.elementStack = [];
this.tokenizer = new EventedTokenizer(this, entityParser);
this.currentNode = null;
this.currentAttribute = null;
if (typeof source === 'string') {
this.source = source.split(/(?:\r\n?|\n)/g);
}
}
combined = plugin.transform(combined);
}
}
return combined;
}
const entityParser = new EntityParser(namedCharRefs);
export class Parser {
private elementStack = [];
private options: Object;
private source: string[];
public currentAttribute = null;
public currentNode = null;
public tokenizer = new EventedTokenizer(this, entityParser);
constructor(source, options: Object = {}) {
this.options = options;
if (typeof source === 'string') {
this.source = source.split(/(?:\r\n?|\n)/g);
}
}
acceptNode(node): Object {
return this[node.type](node);
}
currentElement(): Object {
return this.elementStack[this.elementStack.length - 1];
}
function isAttrValue(node: hbs.Statement | null): node is hbs.AttrValue {
if (node === null) return true;
switch (node.type) {
case 'TextNode':
case 'MustacheStatement':
case 'MustacheContent':
case 'ConcatStatement':
return true;
default:
return false;
}
}
export class HtmlParser implements TokenizerDelegate {
readonly tokenizer = new EventedTokenizer(this, entityParser);
constructor(private source: string, private parser: HandlebarsParser) {}
seek(from: number) {
(this.tokenizer as any).index = from;
(this.tokenizer as any).input = this.source.slice(0, from);
}
get pos() {
return (this.tokenizer as any).index;
}
reset(): void {
return;
}