This commit is contained in:
Sidharth Vinod
2022-09-08 20:41:08 +05:30
parent f60761609c
commit 6138dd8714

View File

@@ -28,14 +28,18 @@ class InfoParser extends EmbeddedActionsParser {
infoDb.clear(); infoDb.clear();
} }
public infoDiagram = this.RULE('infoDiagram', () => { public diagram = this.RULE('diagram', () => {
this.MANY(() => { this.MANY(() => {
this.CONSUME(NewLine); this.CONSUME(NewLine);
}); });
this.SUBRULE(this.hdr); this.SUBRULE(this.hdr);
this.AT_LEAST_ONE(() => { this.MANY2(() => {
this.SUBRULE2(this.row); this.SUBRULE2(this.row);
}); });
infoDb.setInfo(true);
this.MANY3(() => {
this.CONSUME2(NewLine);
});
}); });
public hdr = this.RULE('hdr', () => { public hdr = this.RULE('hdr', () => {
@@ -61,7 +65,7 @@ const parser = new InfoParser();
const parse = (text: string): void => { const parse = (text: string): void => {
const lexResult = InfoLexer.tokenize(text); const lexResult = InfoLexer.tokenize(text);
parser.input = lexResult.tokens; parser.input = lexResult.tokens;
parser.infoDiagram(); parser.diagram();
if (parser.errors.length > 0 || lexResult.errors.length > 0) { if (parser.errors.length > 0 || lexResult.errors.length > 0) {
log.error( log.error(