diff --git a/src/parse/read/expression.js b/src/parse/read/expression.js index 110b6af4ef..904b1c5229 100644 --- a/src/parse/read/expression.js +++ b/src/parse/read/expression.js @@ -3,16 +3,6 @@ import { parseExpressionAt } from 'acorn'; export default function readExpression ( parser ) { 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; try { @@ -21,6 +11,15 @@ export default function readExpression ( parser ) { return node; } 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 ); } }