in lib/parser.js [476:521]
modelBody() {
// modelBody = "{" [ modelFields ] "}"
// modelFields = modelField { "," modelField } [","]
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.modelField();
nodes.push(node);
while (!this.is('}')) {
if (this.is(',')) {
this.move();
if (this.is('}')) {
// only one fields
break;
}
let node = this.modelField();
nodes.push(node);
} else {
this.error('expect ","');
}
}
const end = this.getIndex();
this.match('}');
return {
type: 'modelBody',
nodes: nodes,
tokenRange: [begin, end]
};
}