Small refactoring related to handling XJSText.
Conflicts: acorn.js
This commit is contained in:
parent
4ed5087bea
commit
292942c1d8
26
acorn.js
26
acorn.js
@ -2281,7 +2281,7 @@
|
|||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
case _num: case _string: case _regexp:
|
case _num: case _string: case _regexp: case _xjsText:
|
||||||
var node = startNode();
|
var node = startNode();
|
||||||
node.value = tokVal;
|
node.value = tokVal;
|
||||||
node.raw = input.slice(tokStart, tokEnd);
|
node.raw = input.slice(tokStart, tokEnd);
|
||||||
@ -2968,11 +2968,7 @@
|
|||||||
} else if (tokVal === '<') {
|
} else if (tokVal === '<') {
|
||||||
node = parseXJSElement();
|
node = parseXJSElement();
|
||||||
} else if (tokType === _xjsText) {
|
} else if (tokType === _xjsText) {
|
||||||
node = startNode();
|
node = parseExprAtom();
|
||||||
node.value = tokVal;
|
|
||||||
node.raw = input.slice(tokStart, tokEnd);
|
|
||||||
next();
|
|
||||||
finishNode(node, "Literal");
|
|
||||||
} else {
|
} else {
|
||||||
raise(tokStart, "XJS value should be either an expression or a quoted XJS text");
|
raise(tokStart, "XJS value should be either an expression or a quoted XJS text");
|
||||||
}
|
}
|
||||||
@ -3038,15 +3034,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseXJSChild() {
|
function parseXJSChild() {
|
||||||
if (tokType === _braceL) {
|
switch (tokType) {
|
||||||
|
case _braceL:
|
||||||
return parseXJSExpressionContainer();
|
return parseXJSExpressionContainer();
|
||||||
} else if (tokType === _xjsText) {
|
|
||||||
var node = startNode();
|
case _xjsText:
|
||||||
node.value = tokVal;
|
return parseExprAtom();
|
||||||
node.raw = input.slice(tokStart, tokEnd);
|
|
||||||
next();
|
default:
|
||||||
return finishNode(node, "Literal");
|
|
||||||
} else {
|
|
||||||
return parseXJSElement();
|
return parseXJSElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3089,8 +3084,7 @@
|
|||||||
|
|
||||||
inXJSTag = origInXJSTag;
|
inXJSTag = origInXJSTag;
|
||||||
|
|
||||||
if (tokType === _slash) {
|
if (eat(_slash)) {
|
||||||
next();
|
|
||||||
inXJSChild = origInXJSChild;
|
inXJSChild = origInXJSChild;
|
||||||
node.selfClosing = true;
|
node.selfClosing = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user