Conflicts: acorn.js package.json
This commit is contained in:
commit
7ea883a3b5
14
acorn.js
14
acorn.js
@ -656,8 +656,8 @@
|
|||||||
|
|
||||||
var b_stat = {token: "{", isExpr: false}, b_expr = {token: "{", isExpr: true}, b_tmpl = {token: "${", isExpr: true};
|
var b_stat = {token: "{", isExpr: false}, b_expr = {token: "{", isExpr: true}, b_tmpl = {token: "${", isExpr: true};
|
||||||
var p_stat = {token: "(", isExpr: false}, p_expr = {token: "(", isExpr: true};
|
var p_stat = {token: "(", isExpr: false}, p_expr = {token: "(", isExpr: true};
|
||||||
var j_oTag = {token: "<tag", isExpr: false}, j_cTag = {token: "</tag", isExpr: false}, j_expr = {token: "<tag>...</tag>", isExpr: true};
|
|
||||||
var q_tmpl = {token: "`", isExpr: true}, f_expr = {token: "function", isExpr: true};
|
var q_tmpl = {token: "`", isExpr: true}, f_expr = {token: "function", isExpr: true};
|
||||||
|
var j_oTag = {token: "<tag", isExpr: false}, j_cTag = {token: "</tag", isExpr: false}, j_expr = {token: "<tag>...</tag>", isExpr: true};
|
||||||
|
|
||||||
function curTokContext() {
|
function curTokContext() {
|
||||||
return tokContext[tokContext.length - 1];
|
return tokContext[tokContext.length - 1];
|
||||||
@ -673,10 +673,6 @@
|
|||||||
return true;
|
return true;
|
||||||
if (prevType == _braceL)
|
if (prevType == _braceL)
|
||||||
return curTokContext() === b_stat;
|
return curTokContext() === b_stat;
|
||||||
if (prevType === _jsxTagEnd || prevType === _jsxText)
|
|
||||||
return true;
|
|
||||||
if (prevType === _jsxName)
|
|
||||||
return false;
|
|
||||||
return !tokExprAllowed;
|
return !tokExprAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +692,7 @@
|
|||||||
if (type === _parenR || type === _braceR) {
|
if (type === _parenR || type === _braceR) {
|
||||||
var out = tokContext.pop();
|
var out = tokContext.pop();
|
||||||
if (out === b_tmpl) {
|
if (out === b_tmpl) {
|
||||||
preserveSpace = true;
|
preserveSpace = tokExprAllowed = true;
|
||||||
} else if (out === b_stat && curTokContext() === f_expr) {
|
} else if (out === b_stat && curTokContext() === f_expr) {
|
||||||
tokContext.pop();
|
tokContext.pop();
|
||||||
tokExprAllowed = false;
|
tokExprAllowed = false;
|
||||||
@ -704,7 +700,11 @@
|
|||||||
tokExprAllowed = !(out && out.isExpr);
|
tokExprAllowed = !(out && out.isExpr);
|
||||||
}
|
}
|
||||||
} else if (type === _braceL) {
|
} else if (type === _braceL) {
|
||||||
tokContext.push(braceIsBlock(prevType) ? b_stat : b_expr);
|
switch (curTokContext()) {
|
||||||
|
case j_oTag: tokContext.push(b_expr); break;
|
||||||
|
case j_expr: tokContext.push(b_tmpl); break;
|
||||||
|
default: tokContext.push(braceIsBlock(prevType) ? b_stat : b_expr);
|
||||||
|
}
|
||||||
tokExprAllowed = true;
|
tokExprAllowed = true;
|
||||||
} else if (type === _dollarBraceL) {
|
} else if (type === _dollarBraceL) {
|
||||||
tokContext.push(b_tmpl);
|
tokContext.push(b_tmpl);
|
||||||
|
|||||||
@ -40,6 +40,7 @@ var fbTestFixture = {
|
|||||||
end: { line: 1, column: 5 }
|
end: { line: 1, column: 5 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'<n:a n:v />': {
|
'<n:a n:v />': {
|
||||||
type: 'ExpressionStatement',
|
type: 'ExpressionStatement',
|
||||||
expression: {
|
expression: {
|
||||||
@ -128,6 +129,7 @@ var fbTestFixture = {
|
|||||||
end: { line: 1, column: 11 }
|
end: { line: 1, column: 11 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'<a n:foo="bar"> {value} <b><c /></b></a>': {
|
'<a n:foo="bar"> {value} <b><c /></b></a>': {
|
||||||
type: 'ExpressionStatement',
|
type: 'ExpressionStatement',
|
||||||
expression: {
|
expression: {
|
||||||
@ -330,6 +332,7 @@ var fbTestFixture = {
|
|||||||
end: { line: 1, column: 40 }
|
end: { line: 1, column: 40 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'<a b={" "} c=" " d="&" e="&r;" />': {
|
'<a b={" "} c=" " d="&" e="&r;" />': {
|
||||||
type: "ExpressionStatement",
|
type: "ExpressionStatement",
|
||||||
expression: {
|
expression: {
|
||||||
@ -416,6 +419,7 @@ var fbTestFixture = {
|
|||||||
},
|
},
|
||||||
range: [0, 40]
|
range: [0, 40]
|
||||||
},
|
},
|
||||||
|
|
||||||
'<a\n/>': {
|
'<a\n/>': {
|
||||||
type: "ExpressionStatement",
|
type: "ExpressionStatement",
|
||||||
expression: {
|
expression: {
|
||||||
@ -489,6 +493,7 @@ var fbTestFixture = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'<日本語></日本語>': {
|
'<日本語></日本語>': {
|
||||||
type: "ExpressionStatement",
|
type: "ExpressionStatement",
|
||||||
expression: {
|
expression: {
|
||||||
@ -2541,6 +2546,7 @@ var fbTestFixture = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'<A aa={aa.bb.cc} bb={bb.cc.dd}><div>{aa.b}</div></A>': {
|
'<A aa={aa.bb.cc} bb={bb.cc.dd}><div>{aa.b}</div></A>': {
|
||||||
"type": "ExpressionStatement",
|
"type": "ExpressionStatement",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
@ -3442,6 +3448,145 @@ var fbTestFixture = {
|
|||||||
raw: "/text"
|
raw: "/text"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'<div>{a}{b}</div>': {
|
||||||
|
type: "ExpressionStatement",
|
||||||
|
start: 0,
|
||||||
|
end: 17,
|
||||||
|
expression: {
|
||||||
|
type: "JSXElement",
|
||||||
|
start: 0,
|
||||||
|
end: 17,
|
||||||
|
openingElement: {
|
||||||
|
type: "JSXOpeningElement",
|
||||||
|
start: 0,
|
||||||
|
end: 5,
|
||||||
|
attributes: [],
|
||||||
|
name: {
|
||||||
|
type: "JSXIdentifier",
|
||||||
|
start: 1,
|
||||||
|
end: 4,
|
||||||
|
name: "div"
|
||||||
|
},
|
||||||
|
selfClosing: false
|
||||||
|
},
|
||||||
|
closingElement: {
|
||||||
|
type: "JSXClosingElement",
|
||||||
|
start: 11,
|
||||||
|
end: 17,
|
||||||
|
name: {
|
||||||
|
type: "JSXIdentifier",
|
||||||
|
start: 13,
|
||||||
|
end: 16,
|
||||||
|
name: "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
children: [{
|
||||||
|
type: 'JSXExpressionContainer',
|
||||||
|
expression: {
|
||||||
|
type: 'Identifier',
|
||||||
|
name: 'a',
|
||||||
|
range: [6, 7],
|
||||||
|
loc: {
|
||||||
|
start: {
|
||||||
|
line: 1,
|
||||||
|
column: 6
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
line: 1,
|
||||||
|
column: 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
range: [5, 8],
|
||||||
|
loc: {
|
||||||
|
start: {
|
||||||
|
line: 1,
|
||||||
|
column: 5
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
line: 1,
|
||||||
|
column: 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: 'JSXExpressionContainer',
|
||||||
|
expression: {
|
||||||
|
type: 'Identifier',
|
||||||
|
name: 'b',
|
||||||
|
range: [9, 10],
|
||||||
|
loc: {
|
||||||
|
start: {
|
||||||
|
line: 1,
|
||||||
|
column: 9
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
line: 1,
|
||||||
|
column: 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
range: [8, 11],
|
||||||
|
loc: {
|
||||||
|
start: {
|
||||||
|
line: 1,
|
||||||
|
column: 8
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
line: 1,
|
||||||
|
column: 11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'<div pre="leading" {...props} />': {
|
||||||
|
type: "ExpressionStatement",
|
||||||
|
range: [0, 32],
|
||||||
|
expression: {
|
||||||
|
type: "JSXElement",
|
||||||
|
range: [0, 32],
|
||||||
|
openingElement: {
|
||||||
|
type: "JSXOpeningElement",
|
||||||
|
range: [0, 32],
|
||||||
|
attributes: [
|
||||||
|
{
|
||||||
|
type: "JSXAttribute",
|
||||||
|
range: [5, 18],
|
||||||
|
name: {
|
||||||
|
type: "JSXIdentifier",
|
||||||
|
range: [5, 8],
|
||||||
|
name: "pre"
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: "Literal",
|
||||||
|
range: [9, 18],
|
||||||
|
value: "leading"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "JSXSpreadAttribute",
|
||||||
|
range: [19, 29],
|
||||||
|
argument: {
|
||||||
|
type: "Identifier",
|
||||||
|
range: [23, 28],
|
||||||
|
name: "props"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
name: {
|
||||||
|
type: "JSXIdentifier",
|
||||||
|
range: [1, 4],
|
||||||
|
name: "div"
|
||||||
|
},
|
||||||
|
selfClosing: true
|
||||||
|
},
|
||||||
|
closingElement: null,
|
||||||
|
children: []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user