Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/lu/src/parser/lufile/LUFileParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ paragraph
: newline
| nestedIntentSection
| simpleIntentSection
| entitySection
| newEntitySection
| importSection
| qnaSection
| modelInfoSection
Expand Down Expand Up @@ -49,7 +47,7 @@ subIntentDefinition
;

simpleIntentSection
: intentDefinition (entitySection | newEntitySection)*
: (intentDefinition? (entitySection | newEntitySection)+) | intentDefinition
;

intentDefinition
Expand Down

Large diffs are not rendered by default.

1,621 changes: 842 additions & 779 deletions packages/lu/src/parser/lufile/generated/LUFileParser.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from LUFileParser.g4 by ANTLR 4.7.1
// Generated from ../LUFileParser.g4 by ANTLR 4.7.2
// jshint ignore: start
var antlr4 = require('antlr4/index');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from LUFileParser.g4 by ANTLR 4.7.1
// Generated from ../LUFileParser.g4 by ANTLR 4.7.2
// jshint ignore: start
var antlr4 = require('antlr4/index');

Expand Down
28 changes: 21 additions & 7 deletions packages/lu/src/parser/lufile/luParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class LUParser {

let simpleIntentSections = fileContext.paragraph()
.map(x => x.simpleIntentSection())
.filter(x => x !== undefined && x !== null);
.filter(x => x && x.intentDefinition());

let simpleIntentSectionList = simpleIntentSections.map(x => new SimpleIntentSection(x, content));

Expand All @@ -199,10 +199,17 @@ class LUParser {
}

let entitySections = fileContext.paragraph()
.map(x => x.entitySection())
.filter(x => x !== undefined && x !== null);
.map(x => x.simpleIntentSection())
.filter(x => x && !x.intentDefinition());

let entitySectionList = entitySections.map(x => new EntitySection(x));
let entitySectionList = [];
entitySections.forEach(x => {
if (x.entitySection) {
for (const entitySection of x.entitySection()) {
entitySectionList.push(new EntitySection(entitySection));
}
}
})

return entitySectionList;
}
Expand All @@ -217,10 +224,17 @@ class LUParser {
}

let newEntitySections = fileContext.paragraph()
.map(x => x.newEntitySection())
.filter(x => x !== undefined && x !== null);
.map(x => x.simpleIntentSection())
.filter(x => x && !x.intentDefinition());

let newEntitySectionList = newEntitySections.map(x => new NewEntitySection(x));
let newEntitySectionList = [];
newEntitySections.forEach(x => {
if (x.newEntitySection) {
for (const newEntitySection of x.newEntitySection()) {
newEntitySectionList.push(new NewEntitySection(newEntitySection));
}
}
})

return newEntitySectionList;
}
Expand Down