Skip to content

Commit

Permalink
Fix ANTLR when LU content contains only comments (#6747)
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-joelmut authored Feb 9, 2024
1 parent e5f7ff6 commit 23c03d8
Show file tree
Hide file tree
Showing 11 changed files with 835 additions and 816 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,309 changes: 664 additions & 645 deletions libraries/Parsers/Microsoft.Bot.Builder.Parsers.LU/Generated/LUFileParser.cs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ MODEL_INFO
;

COMMENT
: WS* '>' ~('\r'|'\n')*
: WS* '>' ~('\r'|'\n')* -> skip
;

QNA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parser grammar LUFileParser;
options { tokenVocab=LUFileLexer; }

file
: paragraph+? EOF
: (paragraph+? | commentDefinition?) EOF
;

paragraph
Expand All @@ -16,7 +16,6 @@ paragraph
| referenceSection
| qnaSection
| modelInfoSection
| commentDefinition
;

// Treat EOF as newline to hanle file end gracefully
Expand Down Expand Up @@ -79,7 +78,7 @@ intentBody
;

normalIntentBody
: WS* ((normalIntentString newline) | errorString | commentDefinition)+
: WS* ((normalIntentString newline) | errorString)+
;

normalIntentString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@
"errorMsgs": [

],
"contextText": " - Please set {deviceTemperature = thermostat to 72}",
"contextText": "- Please set {deviceTemperature = thermostat to 72}",
"range": {
"Start": {
"Line": 17,
"Character": 0
"Character": 4
},
"End": {
"Line": 17,
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Severity": "ERROR"
},
{
"Message": "syntax error: extraneous input 'ml' expecting {<EOF>, WS, NEWLINE, QNA_SOURCE_INFO, MODEL_INFO, COMMENT, QNA, HASH, '$', '@', IMPORT, REFERENCE, QNA_ID_MARK}",
"Message": "syntax error: extraneous input 'ml' expecting {<EOF>, WS, NEWLINE, QNA_SOURCE_INFO, MODEL_INFO, QNA, HASH, '$', '@', IMPORT, REFERENCE, QNA_ID_MARK}",
"Range": {
"Start": {
"Line": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Severity": "ERROR"
},
{
"Message": "syntax error: extraneous input 'regex' expecting {<EOF>, WS, NEWLINE, QNA_SOURCE_INFO, MODEL_INFO, COMMENT, QNA, HASH, '$', '@', IMPORT, REFERENCE, QNA_ID_MARK}",
"Message": "syntax error: extraneous input 'regex' expecting {<EOF>, WS, NEWLINE, QNA_SOURCE_INFO, MODEL_INFO, QNA, HASH, '$', '@', IMPORT, REFERENCE, QNA_ID_MARK}",
"Range": {
"Start": {
"Line": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"Severity": "ERROR"
},
{
"Message": "syntax error: extraneous input 'abc' expecting {<EOF>, WS, NEWLINE, QNA_SOURCE_INFO, MODEL_INFO, COMMENT, QNA, HASH, '$', '@', IMPORT, REFERENCE, QNA_ID_MARK}",
"Message": "syntax error: extraneous input 'abc' expecting {<EOF>, WS, NEWLINE, QNA_SOURCE_INFO, MODEL_INFO, QNA, HASH, '$', '@', IMPORT, REFERENCE, QNA_ID_MARK}",
"Range": {
"Start": {
"Line": 2,
Expand Down

0 comments on commit 23c03d8

Please sign in to comment.