in lib/parser.js [585:629]
enumBody() {
// enumBody = "{" [ enumFields ] "}"
const begin = this.getIndex();
this.match('{');
const nodes = [];
if (this.is('}')) {
const end = this.getIndex();
this.move();
return {
type: 'modelBody',
nodes: nodes,
tokenRange: [begin, end]
};
}
var node = this.enumField();
nodes.push(node);
while (!this.is('}')) {
if (this.is(',')) {
this.move();
if (this.is('}')) {
// only one fields
break;
}
let node = this.enumField();
nodes.push(node);
} else {
this.error('expect ","');
}
}
const end = this.getIndex();
this.match('}');
return {
type: 'enumBody',
nodes: nodes,
tokenRange: [begin, end]
};
}