|
|
@ -3,16 +3,6 @@ import { parseExpressionAt } from 'acorn';
|
|
|
|
export default function readExpression ( parser ) {
|
|
|
|
export default function readExpression ( parser ) {
|
|
|
|
const start = parser.index;
|
|
|
|
const start = parser.index;
|
|
|
|
|
|
|
|
|
|
|
|
const name = parser.readUntil( /\s*}}/ );
|
|
|
|
|
|
|
|
if ( name && /^[a-z]+$/.test( name ) ) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
type: 'Identifier',
|
|
|
|
|
|
|
|
start,
|
|
|
|
|
|
|
|
end: start + name.length,
|
|
|
|
|
|
|
|
name
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.index = start;
|
|
|
|
parser.index = start;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -21,6 +11,15 @@ export default function readExpression ( parser ) {
|
|
|
|
|
|
|
|
|
|
|
|
return node;
|
|
|
|
return node;
|
|
|
|
} catch ( err ) {
|
|
|
|
} catch ( err ) {
|
|
|
|
|
|
|
|
const name = parser.readUntil( /\s*}}/ );
|
|
|
|
|
|
|
|
if ( name && /^[a-z]+$/.test( name ) ) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
type: 'Identifier',
|
|
|
|
|
|
|
|
start,
|
|
|
|
|
|
|
|
end: start + name.length,
|
|
|
|
|
|
|
|
name
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
parser.acornError( err );
|
|
|
|
parser.acornError( err );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|