|
|
@ -476,35 +476,28 @@ function read_sequence(parser: Parser, done: () => boolean): Node[] {
|
|
|
|
start: parser.index,
|
|
|
|
start: parser.index,
|
|
|
|
end: null,
|
|
|
|
end: null,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
data: '',
|
|
|
|
raw: '',
|
|
|
|
|
|
|
|
data: null
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function flush() {
|
|
|
|
|
|
|
|
if (current_chunk.raw) {
|
|
|
|
|
|
|
|
current_chunk.data = decode_character_references(current_chunk.raw);
|
|
|
|
|
|
|
|
current_chunk.end = parser.index;
|
|
|
|
|
|
|
|
chunks.push(current_chunk);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const chunks: Node[] = [];
|
|
|
|
const chunks: Node[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
while (parser.index < parser.template.length) {
|
|
|
|
while (parser.index < parser.template.length) {
|
|
|
|
const index = parser.index;
|
|
|
|
const index = parser.index;
|
|
|
|
|
|
|
|
|
|
|
|
if (done()) {
|
|
|
|
if (done()) {
|
|
|
|
current_chunk.end = parser.index;
|
|
|
|
flush();
|
|
|
|
|
|
|
|
|
|
|
|
if (current_chunk.data) chunks.push(current_chunk);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chunks.forEach(chunk => {
|
|
|
|
|
|
|
|
if (chunk.type === 'Text') {
|
|
|
|
|
|
|
|
let decoded = decode_character_references(chunk.data);
|
|
|
|
|
|
|
|
if (chunk.data != decoded) {
|
|
|
|
|
|
|
|
chunk.raw = chunk.data;
|
|
|
|
|
|
|
|
chunk.data = decoded;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return chunks;
|
|
|
|
return chunks;
|
|
|
|
} else if (parser.eat('{')) {
|
|
|
|
} else if (parser.eat('{')) {
|
|
|
|
if (current_chunk.data) {
|
|
|
|
flush();
|
|
|
|
current_chunk.end = index;
|
|
|
|
|
|
|
|
chunks.push(current_chunk);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.allow_whitespace();
|
|
|
|
parser.allow_whitespace();
|
|
|
|
const expression = read_expression(parser);
|
|
|
|
const expression = read_expression(parser);
|
|
|
@ -522,10 +515,11 @@ function read_sequence(parser: Parser, done: () => boolean): Node[] {
|
|
|
|
start: parser.index,
|
|
|
|
start: parser.index,
|
|
|
|
end: null,
|
|
|
|
end: null,
|
|
|
|
type: 'Text',
|
|
|
|
type: 'Text',
|
|
|
|
data: '',
|
|
|
|
raw: '',
|
|
|
|
|
|
|
|
data: null
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
current_chunk.data += parser.template[parser.index++];
|
|
|
|
current_chunk.raw += parser.template[parser.index++];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|