Urara-Blog/node_modules/.pnpm-store/v3/files/69/ed487c0e4bb5e0a5e7aac7736475a66ba380d4276da3cfd3629a720535b3acde637bcb6183e1f09923c9ce22b019234f3bbfdf8bf37f3e0cf5d1bf1fe96d67
2022-08-14 01:14:53 +08:00

38 lines
775 B
Text

'use strict';
const types = require('../../tokenizer/types.cjs');
const name = 'Parentheses';
const structure = {
children: [[]]
};
function parse(readSequence, recognizer) {
const start = this.tokenStart;
let children = null;
this.eat(types.LeftParenthesis);
children = readSequence.call(this, recognizer);
if (!this.eof) {
this.eat(types.RightParenthesis);
}
return {
type: 'Parentheses',
loc: this.getLocation(start, this.tokenStart),
children
};
}
function generate(node) {
this.token(types.LeftParenthesis, '(');
this.children(node);
this.token(types.RightParenthesis, ')');
}
exports.generate = generate;
exports.name = name;
exports.parse = parse;
exports.structure = structure;