Skip to content

Commit

Permalink
Require only '[' and ']' escaping. Add tests for keywords as plain text
Browse files Browse the repository at this point in the history
  • Loading branch information
klntsky committed Nov 23, 2024
1 parent bd3bf0e commit e1eeeb2
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 92 deletions.
14 changes: 8 additions & 6 deletions grammar/MetaPrompt.g4
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ prompt: exprs EOF ;
exprs: expr*? ;
expr: meta_body
| text
| COMMENT_KW
| META_PROMPT
| EQ_KW
| VAR_NAME
| CHOOSE_KW
| EQ_OPTIONAL_KW
| OPTION_KW
| WITH_KW
| DEFAULT_KW
| IS_KW
| CALL
| WITH_KW
| IF_KW
| THEN_KW
| ELSE_KW
| VAR_NAME
;



meta_body
: IF_KW exprs THEN_KW exprs ELSE_KW exprs RB
| IF_KW exprs THEN_KW exprs RB
Expand Down
12 changes: 6 additions & 6 deletions python/src/parse_metaprompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ def visitExpr(self, ctx: MetaPromptParser.ExprContext):
# a token is in a standalone position and should be
# treaded as text
for part in [
ctx.COMMENT_KW(),
ctx.META_PROMPT(),
ctx.EQ_KW(),
ctx.VAR_NAME(),
ctx.CHOOSE_KW(),
ctx.EQ_OPTIONAL_KW(),
ctx.OPTION_KW(),
ctx.WITH_KW(),
ctx.DEFAULT_KW(),
ctx.IS_KW(),
ctx.CALL(),
ctx.WITH_KW(),
ctx.IF_KW(),
ctx.THEN_KW(),
ctx.ELSE_KW(),
ctx.VAR_NAME(),
]:
if part is not None:
return {"type": "text", "text": part.getText()}
Expand Down
2 changes: 1 addition & 1 deletion python/src/parser/MetaPrompt.interp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ text


atn:
[4, 1, 18, 152, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 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, 0, 0, 12, 125, 1, 0, 0, 0, 14, 130, 1, 0, 0, 0, 16, 132, 1, 0, 0, 0, 18, 137, 1, 0, 0, 0, 20, 143, 1, 0, 0, 0, 22, 147, 1, 0, 0, 0, 24, 25, 3, 2, 1, 0, 25, 26, 5, 0, 0, 1, 26, 1, 1, 0, 0, 0, 27, 29, 3, 4, 2, 0, 28, 27, 1, 0, 0, 0, 29, 32, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 30, 28, 1, 0, 0, 0, 31, 3, 1, 0, 0, 0, 32, 30, 1, 0, 0, 0, 33, 46, 3, 6, 3, 0, 34, 46, 3, 22, 11, 0, 35, 46, 5, 6, 0, 0, 36, 46, 5, 5, 0, 0, 37, 46, 5, 3, 0, 0, 38, 46, 5, 18, 0, 0, 39, 46, 5, 11, 0, 0, 40, 46, 5, 12, 0, 0, 41, 46, 5, 14, 0, 0, 42, 46, 5, 15, 0, 0, 43, 46, 5, 9, 0, 0, 44, 46, 5, 13, 0, 0, 45, 33, 1, 0, 0, 0, 45, 34, 1, 0, 0, 0, 45, 35, 1, 0, 0, 0, 45, 36, 1, 0, 0, 0, 45, 37, 1, 0, 0, 0, 45, 38, 1, 0, 0, 0, 45, 39, 1, 0, 0, 0, 45, 40, 1, 0, 0, 0, 45, 41, 1, 0, 0, 0, 45, 42, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 5, 1, 0, 0, 0, 47, 48, 5, 10, 0, 0, 48, 49, 3, 2, 1, 0, 49, 50, 5, 16, 0, 0, 50, 51, 3, 2, 1, 0, 51, 52, 5, 17, 0, 0, 52, 53, 3, 2, 1, 0, 53, 54, 5, 2, 0, 0, 54, 112, 1, 0, 0, 0, 55, 56, 5, 10, 0, 0, 56, 57, 3, 2, 1, 0, 57, 58, 5, 16, 0, 0, 58, 59, 3, 2, 1, 0, 59, 60, 5, 2, 0, 0, 60, 112, 1, 0, 0, 0, 61, 62, 5, 11, 0, 0, 62, 64, 3, 2, 1, 0, 63, 65, 3, 16, 8, 0, 64, 63, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 69, 1, 0, 0, 0, 68, 70, 3, 18, 9, 0, 69, 68, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 72, 5, 2, 0, 0, 72, 112, 1, 0, 0, 0, 73, 74, 5, 8, 0, 0, 74, 75, 3, 20, 10, 0, 75, 76, 5, 2, 0, 0, 76, 112, 1, 0, 0, 0, 77, 78, 5, 5, 0, 0, 78, 79, 3, 2, 1, 0, 79, 80, 5, 2, 0, 0, 80, 112, 1, 0, 0, 0, 81, 82, 5, 6, 0, 0, 82, 83, 3, 2, 1, 0, 83, 84, 5, 2, 0, 0, 84, 112, 1, 0, 0, 0, 85, 86, 5, 1, 0, 0, 86, 87, 3, 8, 4, 0, 87, 88, 5, 2, 0, 0, 88, 112, 1, 0, 0, 0, 89, 112, 3, 10, 5, 0, 90, 91, 5, 1, 0, 0, 91, 92, 5, 18, 0, 0, 92, 112, 5, 2, 0, 0, 93, 94, 5, 9, 0, 0, 94, 98, 3, 12, 6, 0, 95, 97, 3, 14, 7, 0, 96, 95, 1, 0, 0, 0, 97, 100, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 101, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 101, 102, 5, 2, 0, 0, 102, 112, 1, 0, 0, 0, 103, 107, 5, 9, 0, 0, 104, 106, 3, 14, 7, 0, 105, 104, 1, 0, 0, 0, 106, 109, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 110, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 110, 112, 5, 2, 0, 0, 111, 47, 1, 0, 0, 0, 111, 55, 1, 0, 0, 0, 111, 61, 1, 0, 0, 0, 111, 73, 1, 0, 0, 0, 111, 77, 1, 0, 0, 0, 111, 81, 1, 0, 0, 0, 111, 85, 1, 0, 0, 0, 111, 89, 1, 0, 0, 0, 111, 90, 1, 0, 0, 0, 111, 93, 1, 0, 0, 0, 111, 103, 1, 0, 0, 0, 112, 7, 1, 0, 0, 0, 113, 114, 5, 18, 0, 0, 114, 115, 5, 3, 0, 0, 115, 116, 3, 2, 1, 0, 116, 9, 1, 0, 0, 0, 117, 118, 5, 1, 0, 0, 118, 119, 5, 18, 0, 0, 119, 120, 5, 4, 0, 0, 120, 121, 3, 2, 1, 0, 121, 122, 5, 2, 0, 0, 122, 11, 1, 0, 0, 0, 123, 126, 3, 8, 4, 0, 124, 126, 3, 2, 1, 0, 125, 123, 1, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 13, 1, 0, 0, 0, 127, 131, 3, 8, 4, 0, 128, 129, 5, 13, 0, 0, 129, 131, 3, 2, 1, 0, 130, 127, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 131, 15, 1, 0, 0, 0, 132, 133, 5, 12, 0, 0, 133, 134, 3, 2, 1, 0, 134, 135, 5, 15, 0, 0, 135, 136, 3, 2, 1, 0, 136, 17, 1, 0, 0, 0, 137, 138, 5, 14, 0, 0, 138, 139, 3, 2, 1, 0, 139, 19, 1, 0, 0, 0, 140, 142, 3, 8, 4, 0, 141, 140, 1, 0, 0, 0, 142, 145, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 21, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 146, 148, 5, 7, 0, 0, 147, 146, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 23, 1, 0, 0, 0, 11, 30, 45, 66, 69, 98, 107, 111, 125, 130, 143, 149]
[4, 1, 18, 152, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 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, 0, 10, 117, 1, 0, 0, 0, 12, 125, 1, 0, 0, 0, 14, 130, 1, 0, 0, 0, 16, 132, 1, 0, 0, 0, 18, 137, 1, 0, 0, 0, 20, 143, 1, 0, 0, 0, 22, 147, 1, 0, 0, 0, 24, 25, 3, 2, 1, 0, 25, 26, 5, 0, 0, 1, 26, 1, 1, 0, 0, 0, 27, 29, 3, 4, 2, 0, 28, 27, 1, 0, 0, 0, 29, 32, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 30, 28, 1, 0, 0, 0, 31, 3, 1, 0, 0, 0, 32, 30, 1, 0, 0, 0, 33, 46, 3, 6, 3, 0, 34, 46, 3, 22, 11, 0, 35, 46, 5, 3, 0, 0, 36, 46, 5, 4, 0, 0, 37, 46, 5, 12, 0, 0, 38, 46, 5, 13, 0, 0, 39, 46, 5, 14, 0, 0, 40, 46, 5, 15, 0, 0, 41, 46, 5, 10, 0, 0, 42, 46, 5, 16, 0, 0, 43, 46, 5, 17, 0, 0, 44, 46, 5, 18, 0, 0, 45, 33, 1, 0, 0, 0, 45, 34, 1, 0, 0, 0, 45, 35, 1, 0, 0, 0, 45, 36, 1, 0, 0, 0, 45, 37, 1, 0, 0, 0, 45, 38, 1, 0, 0, 0, 45, 39, 1, 0, 0, 0, 45, 40, 1, 0, 0, 0, 45, 41, 1, 0, 0, 0, 45, 42, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 44, 1, 0, 0, 0, 46, 5, 1, 0, 0, 0, 47, 48, 5, 10, 0, 0, 48, 49, 3, 2, 1, 0, 49, 50, 5, 16, 0, 0, 50, 51, 3, 2, 1, 0, 51, 52, 5, 17, 0, 0, 52, 53, 3, 2, 1, 0, 53, 54, 5, 2, 0, 0, 54, 112, 1, 0, 0, 0, 55, 56, 5, 10, 0, 0, 56, 57, 3, 2, 1, 0, 57, 58, 5, 16, 0, 0, 58, 59, 3, 2, 1, 0, 59, 60, 5, 2, 0, 0, 60, 112, 1, 0, 0, 0, 61, 62, 5, 11, 0, 0, 62, 64, 3, 2, 1, 0, 63, 65, 3, 16, 8, 0, 64, 63, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 69, 1, 0, 0, 0, 68, 70, 3, 18, 9, 0, 69, 68, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 72, 5, 2, 0, 0, 72, 112, 1, 0, 0, 0, 73, 74, 5, 8, 0, 0, 74, 75, 3, 20, 10, 0, 75, 76, 5, 2, 0, 0, 76, 112, 1, 0, 0, 0, 77, 78, 5, 5, 0, 0, 78, 79, 3, 2, 1, 0, 79, 80, 5, 2, 0, 0, 80, 112, 1, 0, 0, 0, 81, 82, 5, 6, 0, 0, 82, 83, 3, 2, 1, 0, 83, 84, 5, 2, 0, 0, 84, 112, 1, 0, 0, 0, 85, 86, 5, 1, 0, 0, 86, 87, 3, 8, 4, 0, 87, 88, 5, 2, 0, 0, 88, 112, 1, 0, 0, 0, 89, 112, 3, 10, 5, 0, 90, 91, 5, 1, 0, 0, 91, 92, 5, 18, 0, 0, 92, 112, 5, 2, 0, 0, 93, 94, 5, 9, 0, 0, 94, 98, 3, 12, 6, 0, 95, 97, 3, 14, 7, 0, 96, 95, 1, 0, 0, 0, 97, 100, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 101, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 101, 102, 5, 2, 0, 0, 102, 112, 1, 0, 0, 0, 103, 107, 5, 9, 0, 0, 104, 106, 3, 14, 7, 0, 105, 104, 1, 0, 0, 0, 106, 109, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 110, 1, 0, 0, 0, 109, 107, 1, 0, 0, 0, 110, 112, 5, 2, 0, 0, 111, 47, 1, 0, 0, 0, 111, 55, 1, 0, 0, 0, 111, 61, 1, 0, 0, 0, 111, 73, 1, 0, 0, 0, 111, 77, 1, 0, 0, 0, 111, 81, 1, 0, 0, 0, 111, 85, 1, 0, 0, 0, 111, 89, 1, 0, 0, 0, 111, 90, 1, 0, 0, 0, 111, 93, 1, 0, 0, 0, 111, 103, 1, 0, 0, 0, 112, 7, 1, 0, 0, 0, 113, 114, 5, 18, 0, 0, 114, 115, 5, 3, 0, 0, 115, 116, 3, 2, 1, 0, 116, 9, 1, 0, 0, 0, 117, 118, 5, 1, 0, 0, 118, 119, 5, 18, 0, 0, 119, 120, 5, 4, 0, 0, 120, 121, 3, 2, 1, 0, 121, 122, 5, 2, 0, 0, 122, 11, 1, 0, 0, 0, 123, 126, 3, 8, 4, 0, 124, 126, 3, 2, 1, 0, 125, 123, 1, 0, 0, 0, 125, 124, 1, 0, 0, 0, 126, 13, 1, 0, 0, 0, 127, 131, 3, 8, 4, 0, 128, 129, 5, 13, 0, 0, 129, 131, 3, 2, 1, 0, 130, 127, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 131, 15, 1, 0, 0, 0, 132, 133, 5, 12, 0, 0, 133, 134, 3, 2, 1, 0, 134, 135, 5, 15, 0, 0, 135, 136, 3, 2, 1, 0, 136, 17, 1, 0, 0, 0, 137, 138, 5, 14, 0, 0, 138, 139, 3, 2, 1, 0, 139, 19, 1, 0, 0, 0, 140, 142, 3, 8, 4, 0, 141, 140, 1, 0, 0, 0, 142, 145, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 21, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 146, 148, 5, 7, 0, 0, 147, 146, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 23, 1, 0, 0, 0, 11, 30, 45, 66, 69, 98, 107, 111, 125, 130, 143, 149]
120 changes: 60 additions & 60 deletions python/src/parser/MetaPromptParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,41 @@ def serializedATN():
143,1,0,0,0,22,147,1,0,0,0,24,25,3,2,1,0,25,26,5,0,0,1,26,1,1,0,
0,0,27,29,3,4,2,0,28,27,1,0,0,0,29,32,1,0,0,0,30,31,1,0,0,0,30,28,
1,0,0,0,31,3,1,0,0,0,32,30,1,0,0,0,33,46,3,6,3,0,34,46,3,22,11,0,
35,46,5,6,0,0,36,46,5,5,0,0,37,46,5,3,0,0,38,46,5,18,0,0,39,46,5,
11,0,0,40,46,5,12,0,0,41,46,5,14,0,0,42,46,5,15,0,0,43,46,5,9,0,
0,44,46,5,13,0,0,45,33,1,0,0,0,45,34,1,0,0,0,45,35,1,0,0,0,45,36,
1,0,0,0,45,37,1,0,0,0,45,38,1,0,0,0,45,39,1,0,0,0,45,40,1,0,0,0,
45,41,1,0,0,0,45,42,1,0,0,0,45,43,1,0,0,0,45,44,1,0,0,0,46,5,1,0,
0,0,47,48,5,10,0,0,48,49,3,2,1,0,49,50,5,16,0,0,50,51,3,2,1,0,51,
52,5,17,0,0,52,53,3,2,1,0,53,54,5,2,0,0,54,112,1,0,0,0,55,56,5,10,
0,0,56,57,3,2,1,0,57,58,5,16,0,0,58,59,3,2,1,0,59,60,5,2,0,0,60,
112,1,0,0,0,61,62,5,11,0,0,62,64,3,2,1,0,63,65,3,16,8,0,64,63,1,
0,0,0,65,66,1,0,0,0,66,64,1,0,0,0,66,67,1,0,0,0,67,69,1,0,0,0,68,
70,3,18,9,0,69,68,1,0,0,0,69,70,1,0,0,0,70,71,1,0,0,0,71,72,5,2,
0,0,72,112,1,0,0,0,73,74,5,8,0,0,74,75,3,20,10,0,75,76,5,2,0,0,76,
112,1,0,0,0,77,78,5,5,0,0,78,79,3,2,1,0,79,80,5,2,0,0,80,112,1,0,
0,0,81,82,5,6,0,0,82,83,3,2,1,0,83,84,5,2,0,0,84,112,1,0,0,0,85,
86,5,1,0,0,86,87,3,8,4,0,87,88,5,2,0,0,88,112,1,0,0,0,89,112,3,10,
5,0,90,91,5,1,0,0,91,92,5,18,0,0,92,112,5,2,0,0,93,94,5,9,0,0,94,
98,3,12,6,0,95,97,3,14,7,0,96,95,1,0,0,0,97,100,1,0,0,0,98,96,1,
0,0,0,98,99,1,0,0,0,99,101,1,0,0,0,100,98,1,0,0,0,101,102,5,2,0,
0,102,112,1,0,0,0,103,107,5,9,0,0,104,106,3,14,7,0,105,104,1,0,0,
0,106,109,1,0,0,0,107,105,1,0,0,0,107,108,1,0,0,0,108,110,1,0,0,
0,109,107,1,0,0,0,110,112,5,2,0,0,111,47,1,0,0,0,111,55,1,0,0,0,
111,61,1,0,0,0,111,73,1,0,0,0,111,77,1,0,0,0,111,81,1,0,0,0,111,
85,1,0,0,0,111,89,1,0,0,0,111,90,1,0,0,0,111,93,1,0,0,0,111,103,
1,0,0,0,112,7,1,0,0,0,113,114,5,18,0,0,114,115,5,3,0,0,115,116,3,
2,1,0,116,9,1,0,0,0,117,118,5,1,0,0,118,119,5,18,0,0,119,120,5,4,
0,0,120,121,3,2,1,0,121,122,5,2,0,0,122,11,1,0,0,0,123,126,3,8,4,
0,124,126,3,2,1,0,125,123,1,0,0,0,125,124,1,0,0,0,126,13,1,0,0,0,
127,131,3,8,4,0,128,129,5,13,0,0,129,131,3,2,1,0,130,127,1,0,0,0,
130,128,1,0,0,0,131,15,1,0,0,0,132,133,5,12,0,0,133,134,3,2,1,0,
134,135,5,15,0,0,135,136,3,2,1,0,136,17,1,0,0,0,137,138,5,14,0,0,
138,139,3,2,1,0,139,19,1,0,0,0,140,142,3,8,4,0,141,140,1,0,0,0,142,
145,1,0,0,0,143,141,1,0,0,0,143,144,1,0,0,0,144,21,1,0,0,0,145,143,
1,0,0,0,146,148,5,7,0,0,147,146,1,0,0,0,148,149,1,0,0,0,149,147,
1,0,0,0,149,150,1,0,0,0,150,23,1,0,0,0,11,30,45,66,69,98,107,111,
125,130,143,149
35,46,5,3,0,0,36,46,5,4,0,0,37,46,5,12,0,0,38,46,5,13,0,0,39,46,
5,14,0,0,40,46,5,15,0,0,41,46,5,10,0,0,42,46,5,16,0,0,43,46,5,17,
0,0,44,46,5,18,0,0,45,33,1,0,0,0,45,34,1,0,0,0,45,35,1,0,0,0,45,
36,1,0,0,0,45,37,1,0,0,0,45,38,1,0,0,0,45,39,1,0,0,0,45,40,1,0,0,
0,45,41,1,0,0,0,45,42,1,0,0,0,45,43,1,0,0,0,45,44,1,0,0,0,46,5,1,
0,0,0,47,48,5,10,0,0,48,49,3,2,1,0,49,50,5,16,0,0,50,51,3,2,1,0,
51,52,5,17,0,0,52,53,3,2,1,0,53,54,5,2,0,0,54,112,1,0,0,0,55,56,
5,10,0,0,56,57,3,2,1,0,57,58,5,16,0,0,58,59,3,2,1,0,59,60,5,2,0,
0,60,112,1,0,0,0,61,62,5,11,0,0,62,64,3,2,1,0,63,65,3,16,8,0,64,
63,1,0,0,0,65,66,1,0,0,0,66,64,1,0,0,0,66,67,1,0,0,0,67,69,1,0,0,
0,68,70,3,18,9,0,69,68,1,0,0,0,69,70,1,0,0,0,70,71,1,0,0,0,71,72,
5,2,0,0,72,112,1,0,0,0,73,74,5,8,0,0,74,75,3,20,10,0,75,76,5,2,0,
0,76,112,1,0,0,0,77,78,5,5,0,0,78,79,3,2,1,0,79,80,5,2,0,0,80,112,
1,0,0,0,81,82,5,6,0,0,82,83,3,2,1,0,83,84,5,2,0,0,84,112,1,0,0,0,
85,86,5,1,0,0,86,87,3,8,4,0,87,88,5,2,0,0,88,112,1,0,0,0,89,112,
3,10,5,0,90,91,5,1,0,0,91,92,5,18,0,0,92,112,5,2,0,0,93,94,5,9,0,
0,94,98,3,12,6,0,95,97,3,14,7,0,96,95,1,0,0,0,97,100,1,0,0,0,98,
96,1,0,0,0,98,99,1,0,0,0,99,101,1,0,0,0,100,98,1,0,0,0,101,102,5,
2,0,0,102,112,1,0,0,0,103,107,5,9,0,0,104,106,3,14,7,0,105,104,1,
0,0,0,106,109,1,0,0,0,107,105,1,0,0,0,107,108,1,0,0,0,108,110,1,
0,0,0,109,107,1,0,0,0,110,112,5,2,0,0,111,47,1,0,0,0,111,55,1,0,
0,0,111,61,1,0,0,0,111,73,1,0,0,0,111,77,1,0,0,0,111,81,1,0,0,0,
111,85,1,0,0,0,111,89,1,0,0,0,111,90,1,0,0,0,111,93,1,0,0,0,111,
103,1,0,0,0,112,7,1,0,0,0,113,114,5,18,0,0,114,115,5,3,0,0,115,116,
3,2,1,0,116,9,1,0,0,0,117,118,5,1,0,0,118,119,5,18,0,0,119,120,5,
4,0,0,120,121,3,2,1,0,121,122,5,2,0,0,122,11,1,0,0,0,123,126,3,8,
4,0,124,126,3,2,1,0,125,123,1,0,0,0,125,124,1,0,0,0,126,13,1,0,0,
0,127,131,3,8,4,0,128,129,5,13,0,0,129,131,3,2,1,0,130,127,1,0,0,
0,130,128,1,0,0,0,131,15,1,0,0,0,132,133,5,12,0,0,133,134,3,2,1,
0,134,135,5,15,0,0,135,136,3,2,1,0,136,17,1,0,0,0,137,138,5,14,0,
0,138,139,3,2,1,0,139,19,1,0,0,0,140,142,3,8,4,0,141,140,1,0,0,0,
142,145,1,0,0,0,143,141,1,0,0,0,143,144,1,0,0,0,144,21,1,0,0,0,145,
143,1,0,0,0,146,148,5,7,0,0,147,146,1,0,0,0,148,149,1,0,0,0,149,
147,1,0,0,0,149,150,1,0,0,0,150,23,1,0,0,0,11,30,45,66,69,98,107,
111,125,130,143,149
]

class MetaPromptParser ( Parser ):
Expand Down Expand Up @@ -258,35 +258,35 @@ def text(self):
return self.getTypedRuleContext(MetaPromptParser.TextContext,0)


def COMMENT_KW(self):
return self.getToken(MetaPromptParser.COMMENT_KW, 0)

def META_PROMPT(self):
return self.getToken(MetaPromptParser.META_PROMPT, 0)

def EQ_KW(self):
return self.getToken(MetaPromptParser.EQ_KW, 0)

def VAR_NAME(self):
return self.getToken(MetaPromptParser.VAR_NAME, 0)

def CHOOSE_KW(self):
return self.getToken(MetaPromptParser.CHOOSE_KW, 0)
def EQ_OPTIONAL_KW(self):
return self.getToken(MetaPromptParser.EQ_OPTIONAL_KW, 0)

def OPTION_KW(self):
return self.getToken(MetaPromptParser.OPTION_KW, 0)

def WITH_KW(self):
return self.getToken(MetaPromptParser.WITH_KW, 0)

def DEFAULT_KW(self):
return self.getToken(MetaPromptParser.DEFAULT_KW, 0)

def IS_KW(self):
return self.getToken(MetaPromptParser.IS_KW, 0)

def CALL(self):
return self.getToken(MetaPromptParser.CALL, 0)
def IF_KW(self):
return self.getToken(MetaPromptParser.IF_KW, 0)

def WITH_KW(self):
return self.getToken(MetaPromptParser.WITH_KW, 0)
def THEN_KW(self):
return self.getToken(MetaPromptParser.THEN_KW, 0)

def ELSE_KW(self):
return self.getToken(MetaPromptParser.ELSE_KW, 0)

def VAR_NAME(self):
return self.getToken(MetaPromptParser.VAR_NAME, 0)

def getRuleIndex(self):
return MetaPromptParser.RULE_expr
Expand Down Expand Up @@ -331,61 +331,61 @@ def expr(self):
elif la_ == 3:
self.enterOuterAlt(localctx, 3)
self.state = 35
self.match(MetaPromptParser.COMMENT_KW)
self.match(MetaPromptParser.EQ_KW)
pass

elif la_ == 4:
self.enterOuterAlt(localctx, 4)
self.state = 36
self.match(MetaPromptParser.META_PROMPT)
self.match(MetaPromptParser.EQ_OPTIONAL_KW)
pass

elif la_ == 5:
self.enterOuterAlt(localctx, 5)
self.state = 37
self.match(MetaPromptParser.EQ_KW)
self.match(MetaPromptParser.OPTION_KW)
pass

elif la_ == 6:
self.enterOuterAlt(localctx, 6)
self.state = 38
self.match(MetaPromptParser.VAR_NAME)
self.match(MetaPromptParser.WITH_KW)
pass

elif la_ == 7:
self.enterOuterAlt(localctx, 7)
self.state = 39
self.match(MetaPromptParser.CHOOSE_KW)
self.match(MetaPromptParser.DEFAULT_KW)
pass

elif la_ == 8:
self.enterOuterAlt(localctx, 8)
self.state = 40
self.match(MetaPromptParser.OPTION_KW)
self.match(MetaPromptParser.IS_KW)
pass

elif la_ == 9:
self.enterOuterAlt(localctx, 9)
self.state = 41
self.match(MetaPromptParser.DEFAULT_KW)
self.match(MetaPromptParser.IF_KW)
pass

elif la_ == 10:
self.enterOuterAlt(localctx, 10)
self.state = 42
self.match(MetaPromptParser.IS_KW)
self.match(MetaPromptParser.THEN_KW)
pass

elif la_ == 11:
self.enterOuterAlt(localctx, 11)
self.state = 43
self.match(MetaPromptParser.CALL)
self.match(MetaPromptParser.ELSE_KW)
pass

elif la_ == 12:
self.enterOuterAlt(localctx, 12)
self.state = 44
self.match(MetaPromptParser.WITH_KW)
self.match(MetaPromptParser.VAR_NAME)
pass


Expand Down
Loading

0 comments on commit e1eeeb2

Please sign in to comment.