mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Avoid for(const ... of ...) usage in webidl parser.
Servo's JS engine doesn't support this construct yet.
This commit is contained in:
parent
2b6f573eb5
commit
de1c2394a5
1 changed files with 5 additions and 3 deletions
|
@ -14,7 +14,8 @@
|
||||||
const types = ["float", "integer", "identifier", "string", "whitespace", "other"];
|
const types = ["float", "integer", "identifier", "string", "whitespace", "other"];
|
||||||
while (str.length > 0) {
|
while (str.length > 0) {
|
||||||
let matched = false;
|
let matched = false;
|
||||||
for (const type of types) {
|
for (var i in types) {
|
||||||
|
const type = types[i];
|
||||||
str = str.replace(re[type], tok => {
|
str = str.replace(re[type], tok => {
|
||||||
tokens.push({ type, value: tok });
|
tokens.push({ type, value: tok });
|
||||||
matched = true;
|
matched = true;
|
||||||
|
@ -119,10 +120,11 @@
|
||||||
"multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//
|
"multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//
|
||||||
};
|
};
|
||||||
const wsTypes = [];
|
const wsTypes = [];
|
||||||
for (const k in re) wsTypes.push(k);
|
for (var k in re) wsTypes.push(k);
|
||||||
while (w.length) {
|
while (w.length) {
|
||||||
let matched = false;
|
let matched = false;
|
||||||
for (const type of wsTypes) {
|
for (var i in wsTypes) {
|
||||||
|
const type = wsTypes[i];
|
||||||
w = w.replace(re[type], (tok, m1) => {
|
w = w.replace(re[type], (tok, m1) => {
|
||||||
store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });
|
store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });
|
||||||
matched = true;
|
matched = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue