remove old special handling of {keyword}

pull/4390/head
Conduitry 6 years ago
parent a40f4ad5e3
commit 55d7a8c277

@ -1,37 +1,9 @@
import { parse_expression_at } from '../acorn'; import { parse_expression_at } from '../acorn';
import { Parser } from '../index'; import { Parser } from '../index';
import { Identifier, Node, SimpleLiteral } from 'estree'; import { Node } from 'estree';
import { whitespace } from '../../utils/patterns'; import { whitespace } from '../../utils/patterns';
const literals = new Map([['true', true], ['false', false], ['null', null]]);
export default function read_expression(parser: Parser): Node { export default function read_expression(parser: Parser): Node {
const start = parser.index;
const name = parser.read_until(/\s*}/);
if (name && /^[a-z]+$/.test(name)) {
const end = start + name.length;
if (literals.has(name)) {
return {
type: 'Literal',
start,
end,
value: literals.get(name),
raw: name,
} as SimpleLiteral;
}
return {
type: 'Identifier',
start,
end: start + name.length,
name,
} as Identifier;
}
parser.index = start;
try { try {
const node = parse_expression_at(parser.template, parser.index); const node = parse_expression_at(parser.template, parser.index);

Loading…
Cancel
Save