Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 4ac2e29

Browse files
authored
support special chats in entity type definition (#358)
1 parent 6dbebec commit 4ac2e29

File tree

13 files changed

+1047
-1070
lines changed

13 files changed

+1047
-1070
lines changed

packages/lu/src/parser/lufile/LUFileLexer.g4

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ NEWLINE_IN_ENTITY
186186
: '\r'? '\n' {this.ignoreWS = true;} -> type(NEWLINE), popMode
187187
;
188188

189-
ENTITY_IDENTIFIER
190-
: (LETTER | NUMBER | '_' | '-' | '|' | '.')+ { this.ignoreWS = false;}
191-
;
192-
193189
COMPOSITE_ENTITY
194190
: '[' (~[\r\n{}[()])*
195191
;
@@ -198,12 +194,12 @@ REGEX_ENTITY
198194
: '/' (~[\r\n])*
199195
;
200196

201-
COLON_MARK
202-
: ':'
197+
ENTITY_TEXT
198+
: ~[ \t\r\n:]+ { this.ignoreWS = false;}
203199
;
204200

205-
SPECIAL_CHAR_MARK
206-
: '=' | ',' | '!'
201+
COLON_MARK
202+
: ':'
207203
;
208204

209205
mode QNA_MODE;

packages/lu/src/parser/lufile/LUFileParser.g4

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ entityLine
108108
;
109109

110110
entityName
111-
: (entityIdentifier|WS)*
111+
: (ENTITY_TEXT|WS)*
112112
;
113113

114114
entityType
115-
: (entityIdentifier|compositeEntityIdentifier|regexEntityIdentifier|SPECIAL_CHAR_MARK|COLON_MARK|WS)*
115+
: (compositeEntityIdentifier|regexEntityIdentifier|ENTITY_TEXT|COLON_MARK|WS)*
116116
;
117117

118118
compositeEntityIdentifier
@@ -123,10 +123,6 @@ regexEntityIdentifier
123123
: REGEX_ENTITY
124124
;
125125

126-
entityIdentifier
127-
: ENTITY_IDENTIFIER
128-
;
129-
130126
entityListBody
131127
: (normalItemString newline)+
132128
;

packages/lu/src/parser/lufile/generated/LUFileLexer.interp

Lines changed: 3 additions & 6 deletions
Large diffs are not rendered by default.

packages/lu/src/parser/lufile/generated/LUFileLexer.js

Lines changed: 422 additions & 427 deletions
Large diffs are not rendered by default.

packages/lu/src/parser/lufile/generated/LUFileLexer.tokens

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ ESCAPE_CHARACTER=30
3131
EXPRESSION=31
3232
TEXT=32
3333
WS_IN_ENTITY_IGNORED=33
34-
ENTITY_IDENTIFIER=34
35-
COMPOSITE_ENTITY=35
36-
REGEX_ENTITY=36
34+
COMPOSITE_ENTITY=34
35+
REGEX_ENTITY=35
36+
ENTITY_TEXT=36
3737
COLON_MARK=37
38-
SPECIAL_CHAR_MARK=38
39-
WS_IN_QNA_IGNORED=39
40-
QNA_TEXT=40
38+
WS_IN_QNA_IGNORED=38
39+
QNA_TEXT=39
4140
'**Filters:**'=12
4241
','=16
4342
'='=17

packages/lu/src/parser/lufile/generated/LUFileParser.interp

Lines changed: 2 additions & 5 deletions
Large diffs are not rendered by default.

packages/lu/src/parser/lufile/generated/LUFileParser.js

Lines changed: 538 additions & 588 deletions
Large diffs are not rendered by default.

packages/lu/src/parser/lufile/generated/LUFileParser.tokens

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ ESCAPE_CHARACTER=30
3131
EXPRESSION=31
3232
TEXT=32
3333
WS_IN_ENTITY_IGNORED=33
34-
ENTITY_IDENTIFIER=34
35-
COMPOSITE_ENTITY=35
36-
REGEX_ENTITY=36
34+
COMPOSITE_ENTITY=34
35+
REGEX_ENTITY=35
36+
ENTITY_TEXT=36
3737
COLON_MARK=37
38-
SPECIAL_CHAR_MARK=38
39-
WS_IN_QNA_IGNORED=39
40-
QNA_TEXT=40
38+
WS_IN_QNA_IGNORED=38
39+
QNA_TEXT=39
4140
'**Filters:**'=12
4241
','=16
4342
'='=17

packages/lu/src/parser/lufile/generated/LUFileParserListener.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated from LUFileParser.g4 by ANTLR 4.7.1
1+
// Generated from ../LUFileParser.g4 by ANTLR 4.7.2
22
// jshint ignore: start
33
var antlr4 = require('antlr4/index');
44

@@ -263,15 +263,6 @@ LUFileParserListener.prototype.exitRegexEntityIdentifier = function(ctx) {
263263
};
264264

265265

266-
// Enter a parse tree produced by LUFileParser#entityIdentifier.
267-
LUFileParserListener.prototype.enterEntityIdentifier = function(ctx) {
268-
};
269-
270-
// Exit a parse tree produced by LUFileParser#entityIdentifier.
271-
LUFileParserListener.prototype.exitEntityIdentifier = function(ctx) {
272-
};
273-
274-
275266
// Enter a parse tree produced by LUFileParser#entityListBody.
276267
LUFileParserListener.prototype.enterEntityListBody = function(ctx) {
277268
};

packages/lu/src/parser/lufile/generated/LUFileParserVisitor.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated from LUFileParser.g4 by ANTLR 4.7.1
1+
// Generated from ../LUFileParser.g4 by ANTLR 4.7.2
22
// jshint ignore: start
33
var antlr4 = require('antlr4/index');
44

@@ -180,12 +180,6 @@ LUFileParserVisitor.prototype.visitRegexEntityIdentifier = function(ctx) {
180180
};
181181

182182

183-
// Visit a parse tree produced by LUFileParser#entityIdentifier.
184-
LUFileParserVisitor.prototype.visitEntityIdentifier = function(ctx) {
185-
return this.visitChildren(ctx);
186-
};
187-
188-
189183
// Visit a parse tree produced by LUFileParser#entityListBody.
190184
LUFileParserVisitor.prototype.visitEntityListBody = function(ctx) {
191185
return this.visitChildren(ctx);

0 commit comments

Comments
 (0)