mirror of https://github.com/sveltejs/svelte
parent
43c257b62e
commit
a08cb44377
@ -1,11 +1,15 @@
|
|||||||
import { parseExpressionAt } from 'acorn';
|
import { parseExpressionAt } from 'acorn';
|
||||||
|
|
||||||
export default function readExpression ( parser ) {
|
export default function readExpression ( parser ) {
|
||||||
const node = parseExpressionAt( parser.template, parser.index );
|
try {
|
||||||
parser.index = node.end;
|
const node = parseExpressionAt( parser.template, parser.index );
|
||||||
|
parser.index = node.end;
|
||||||
|
|
||||||
// TODO check it's a valid expression. probably shouldn't have
|
// TODO check it's a valid expression. probably shouldn't have
|
||||||
// [arrow] function expressions, etc
|
// [arrow] function expressions, etc
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
} catch ( err ) {
|
||||||
|
parser.acornError( err );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
export default function spaces ( i ) {
|
||||||
|
let result = '';
|
||||||
|
while ( i-- ) result += ' ';
|
||||||
|
return result;
|
||||||
|
}
|
Loading…
Reference in new issue