in src/langs/common/combinator.js [153:187]
grammer(emit, gram, eol = true, newLine = true) {
if (gram instanceof AnnotationItem) {
this.emitAnnotation(emit, gram);
return;
}
let emitter = new Emitter(this.config);
let method = null;
if (gram instanceof Behavior) {
method = gram.name;
} else if (gram instanceof Grammer) {
method = _lowerFirst(gram.constructor.name);
} else {
debug.stack('Unsupported', gram);
}
if (typeof this[method] !== 'undefined') {
this[method].call(this, emitter, gram);
} else {
debug.stack('Unimpelemented : ' + method);
}
if (gram.eol !== null) {
eol = gram.eol;
}
if (gram.newLine !== null) {
newLine = gram.newLine;
}
if (newLine) {
emit.emit('', this.level);
}
emit.emit(emitter.output);
if (eol) {
emit.emitln(this.eol);
}
emitter = null;
}