Skip to content

Commit 4ad9e52

Browse files
committed
Add startsWith and endsWith operators
1 parent cead43c commit 4ad9e52

19 files changed

+975
-650
lines changed

checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (v *visitor) BinaryNode(node *ast.BinaryNode) reflect.Type {
210210
return stringType
211211
}
212212

213-
case "contains":
213+
case "contains", "startsWith", "endsWith":
214214
if (isString(l) || isInterface(l)) && (isString(r) || isInterface(r)) {
215215
return boolType
216216
}

checker/checker_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ func TestCheck(t *testing.T) {
117117
"Str matches 'ok'",
118118
"Str matches Any",
119119
"Any matches Any",
120+
"'foo' contains 'bar'",
121+
"'foo' startsWith 'bar'",
122+
"'foo' endsWith 'bar'",
120123
"len([])",
121124
"true == false",
122125
"nil",

compiler/compiler.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ func (c *compiler) BinaryNode(node *ast.BinaryNode) {
302302
c.compile(node.Right)
303303
c.emit(OpContains)
304304

305+
case "startsWith":
306+
c.compile(node.Left)
307+
c.compile(node.Right)
308+
c.emit(OpContains)
309+
310+
case "endsWith":
311+
c.compile(node.Left)
312+
c.compile(node.Right)
313+
c.emit(OpContains)
314+
305315
case "..":
306316
c.compile(node.Left)
307317
c.compile(node.Right)

parser/Expr.g4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ expr
1515
| expr op=( '*' | '**' | '/' | '%' ) expr # MultiplicativeExpression
1616
| expr op=( '+' | '-' ) expr # AdditiveExpression
1717
| expr op=( '<' | '>' | '<=' | '>=' ) expr # RelationalExpression
18+
| expr op=StartsWith expr # StartsWithExpression
19+
| expr op=EndsWith expr # EndsWithExpression
1820
| expr op=Contains expr # ContainsExpression
1921
| expr op=Matches pattern=expr # MatchesExpression
2022
| expr op=( In | NotIn ) expr # InExpression
@@ -125,6 +127,8 @@ Pointer : '#';
125127
And : ( '&&' | 'and' );
126128
Or : ( '||' | 'or' );
127129
Builtins : ( 'all' | 'none' | 'any' | 'one' | 'filter' | 'map' );
130+
StartsWith : 'startsWith';
131+
EndsWith : 'endsWith';
128132
Contains : 'contains';
129133
Matches : 'matches';
130134
In : 'in';

parser/gen/expr.interp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ null
3939
null
4040
null
4141
null
42+
'startsWith'
43+
'endsWith'
4244
'contains'
4345
'matches'
4446
'in'
@@ -97,6 +99,8 @@ Pointer
9799
And
98100
Or
99101
Builtins
102+
StartsWith
103+
EndsWith
100104
Contains
101105
Matches
102106
In
@@ -131,4 +135,4 @@ integerLiteral
131135

132136

133137
atn:
134-
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 57, 219, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 47, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 96, 10, 3, 3, 3, 7, 3, 99, 10, 3, 12, 3, 14, 3, 102, 11, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 151, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 7, 6, 160, 10, 6, 12, 6, 14, 6, 163, 11, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 171, 10, 7, 12, 7, 14, 7, 174, 11, 7, 3, 7, 5, 7, 177, 10, 7, 3, 7, 3, 7, 5, 7, 181, 10, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 188, 10, 8, 3, 8, 3, 8, 5, 8, 192, 10, 8, 3, 9, 3, 9, 3, 9, 7, 9, 197, 10, 9, 12, 9, 14, 9, 200, 11, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 213, 10, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 2, 3, 4, 15, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 2, 10, 3, 2, 23, 25, 3, 2, 26, 29, 3, 2, 23, 24, 3, 2, 32, 35, 3, 2, 44, 45, 3, 2, 36, 37, 3, 2, 51, 52, 4, 2, 48, 48, 50, 50, 2, 245, 2, 28, 3, 2, 2, 2, 4, 46, 3, 2, 2, 2, 6, 150, 3, 2, 2, 2, 8, 152, 3, 2, 2, 2, 10, 156, 3, 2, 2, 2, 12, 180, 3, 2, 2, 2, 14, 191, 3, 2, 2, 2, 16, 193, 3, 2, 2, 2, 18, 201, 3, 2, 2, 2, 20, 205, 3, 2, 2, 2, 22, 212, 3, 2, 2, 2, 24, 214, 3, 2, 2, 2, 26, 216, 3, 2, 2, 2, 28, 29, 5, 4, 3, 2, 29, 30, 7, 2, 2, 3, 30, 3, 3, 2, 2, 2, 31, 32, 8, 3, 1, 2, 32, 33, 7, 22, 2, 2, 33, 47, 7, 51, 2, 2, 34, 47, 5, 6, 4, 2, 35, 36, 9, 2, 2, 2, 36, 47, 5, 4, 3, 20, 37, 47, 7, 51, 2, 2, 38, 47, 7, 38, 2, 2, 39, 47, 5, 22, 12, 2, 40, 47, 5, 12, 7, 2, 41, 47, 5, 14, 8, 2, 42, 43, 7, 13, 2, 2, 43, 44, 5, 4, 3, 2, 44, 45, 7, 14, 2, 2, 45, 47, 3, 2, 2, 2, 46, 31, 3, 2, 2, 2, 46, 34, 3, 2, 2, 2, 46, 35, 3, 2, 2, 2, 46, 37, 3, 2, 2, 2, 46, 38, 3, 2, 2, 2, 46, 39, 3, 2, 2, 2, 46, 40, 3, 2, 2, 2, 46, 41, 3, 2, 2, 2, 46, 42, 3, 2, 2, 2, 47, 100, 3, 2, 2, 2, 48, 49, 12, 19, 2, 2, 49, 50, 7, 3, 2, 2, 50, 99, 5, 4, 3, 20, 51, 52, 12, 18, 2, 2, 52, 53, 9, 3, 2, 2, 53, 99, 5, 4, 3, 19, 54, 55, 12, 17, 2, 2, 55, 56, 9, 4, 2, 2, 56, 99, 5, 4, 3, 18, 57, 58, 12, 16, 2, 2, 58, 59, 9, 5, 2, 2, 59, 99, 5, 4, 3, 17, 60, 61, 12, 15, 2, 2, 61, 62, 7, 42, 2, 2, 62, 99, 5, 4, 3, 16, 63, 64, 12, 14, 2, 2, 64, 65, 7, 43, 2, 2, 65, 99, 5, 4, 3, 15, 66, 67, 12, 13, 2, 2, 67, 68, 9, 6, 2, 2, 68, 99, 5, 4, 3, 14, 69, 70, 12, 12, 2, 2, 70, 71, 9, 7, 2, 2, 71, 99, 5, 4, 3, 13, 72, 73, 12, 11, 2, 2, 73, 74, 7, 39, 2, 2, 74, 99, 5, 4, 3, 12, 75, 76, 12, 10, 2, 2, 76, 77, 7, 40, 2, 2, 77, 99, 5, 4, 3, 11, 78, 79, 12, 9, 2, 2, 79, 80, 7, 20, 2, 2, 80, 81, 5, 4, 3, 2, 81, 82, 7, 21, 2, 2, 82, 83, 5, 4, 3, 10, 83, 99, 3, 2, 2, 2, 84, 85, 12, 24, 2, 2, 85, 86, 7, 11, 2, 2, 86, 87, 5, 4, 3, 2, 87, 88, 7, 12, 2, 2, 88, 99, 3, 2, 2, 2, 89, 90, 12, 23, 2, 2, 90, 91, 7, 22, 2, 2, 91, 99, 7, 51, 2, 2, 92, 93, 12, 21, 2, 2, 93, 95, 7, 13, 2, 2, 94, 96, 5, 10, 6, 2, 95, 94, 3, 2, 2, 2, 95, 96, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 99, 7, 14, 2, 2, 98, 48, 3, 2, 2, 2, 98, 51, 3, 2, 2, 2, 98, 54, 3, 2, 2, 2, 98, 57, 3, 2, 2, 2, 98, 60, 3, 2, 2, 2, 98, 63, 3, 2, 2, 2, 98, 66, 3, 2, 2, 2, 98, 69, 3, 2, 2, 2, 98, 72, 3, 2, 2, 2, 98, 75, 3, 2, 2, 2, 98, 78, 3, 2, 2, 2, 98, 84, 3, 2, 2, 2, 98, 89, 3, 2, 2, 2, 98, 92, 3, 2, 2, 2, 99, 102, 3, 2, 2, 2, 100, 98, 3, 2, 2, 2, 100, 101, 3, 2, 2, 2, 101, 5, 3, 2, 2, 2, 102, 100, 3, 2, 2, 2, 103, 104, 7, 4, 2, 2, 104, 105, 7, 13, 2, 2, 105, 106, 5, 4, 3, 2, 106, 107, 7, 14, 2, 2, 107, 151, 3, 2, 2, 2, 108, 109, 7, 5, 2, 2, 109, 110, 7, 13, 2, 2, 110, 111, 5, 4, 3, 2, 111, 112, 7, 18, 2, 2, 112, 113, 5, 8, 5, 2, 113, 114, 7, 14, 2, 2, 114, 151, 3, 2, 2, 2, 115, 116, 7, 6, 2, 2, 116, 117, 7, 13, 2, 2, 117, 118, 5, 4, 3, 2, 118, 119, 7, 18, 2, 2, 119, 120, 5, 8, 5, 2, 120, 121, 7, 14, 2, 2, 121, 151, 3, 2, 2, 2, 122, 123, 7, 7, 2, 2, 123, 124, 7, 13, 2, 2, 124, 125, 5, 4, 3, 2, 125, 126, 7, 18, 2, 2, 126, 127, 5, 8, 5, 2, 127, 128, 7, 14, 2, 2, 128, 151, 3, 2, 2, 2, 129, 130, 7, 8, 2, 2, 130, 131, 7, 13, 2, 2, 131, 132, 5, 4, 3, 2, 132, 133, 7, 18, 2, 2, 133, 134, 5, 8, 5, 2, 134, 135, 7, 14, 2, 2, 135, 151, 3, 2, 2, 2, 136, 137, 7, 9, 2, 2, 137, 138, 7, 13, 2, 2, 138, 139, 5, 4, 3, 2, 139, 140, 7, 18, 2, 2, 140, 141, 5, 8, 5, 2, 141, 142, 7, 14, 2, 2, 142, 151, 3, 2, 2, 2, 143, 144, 7, 10, 2, 2, 144, 145, 7, 13, 2, 2, 145, 146, 5, 4, 3, 2, 146, 147, 7, 18, 2, 2, 147, 148, 5, 8, 5, 2, 148, 149, 7, 14, 2, 2, 149, 151, 3, 2, 2, 2, 150, 103, 3, 2, 2, 2, 150, 108, 3, 2, 2, 2, 150, 115, 3, 2, 2, 2, 150, 122, 3, 2, 2, 2, 150, 129, 3, 2, 2, 2, 150, 136, 3, 2, 2, 2, 150, 143, 3, 2, 2, 2, 151, 7, 3, 2, 2, 2, 152, 153, 7, 15, 2, 2, 153, 154, 5, 4, 3, 2, 154, 155, 7, 16, 2, 2, 155, 9, 3, 2, 2, 2, 156, 161, 5, 4, 3, 2, 157, 158, 7, 18, 2, 2, 158, 160, 5, 4, 3, 2, 159, 157, 3, 2, 2, 2, 160, 163, 3, 2, 2, 2, 161, 159, 3, 2, 2, 2, 161, 162, 3, 2, 2, 2, 162, 11, 3, 2, 2, 2, 163, 161, 3, 2, 2, 2, 164, 165, 7, 11, 2, 2, 165, 181, 7, 12, 2, 2, 166, 167, 7, 11, 2, 2, 167, 172, 5, 4, 3, 2, 168, 169, 7, 18, 2, 2, 169, 171, 5, 4, 3, 2, 170, 168, 3, 2, 2, 2, 171, 174, 3, 2, 2, 2, 172, 170, 3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 176, 3, 2, 2, 2, 174, 172, 3, 2, 2, 2, 175, 177, 7, 18, 2, 2, 176, 175, 3, 2, 2, 2, 176, 177, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2, 178, 179, 7, 12, 2, 2, 179, 181, 3, 2, 2, 2, 180, 164, 3, 2, 2, 2, 180, 166, 3, 2, 2, 2, 181, 13, 3, 2, 2, 2, 182, 183, 7, 15, 2, 2, 183, 192, 7, 16, 2, 2, 184, 185, 7, 15, 2, 2, 185, 187, 5, 16, 9, 2, 186, 188, 7, 18, 2, 2, 187, 186, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 189, 3, 2, 2, 2, 189, 190, 7, 16, 2, 2, 190, 192, 3, 2, 2, 2, 191, 182, 3, 2, 2, 2, 191, 184, 3, 2, 2, 2, 192, 15, 3, 2, 2, 2, 193, 198, 5, 18, 10, 2, 194, 195, 7, 18, 2, 2, 195, 197, 5, 18, 10, 2, 196, 194, 3, 2, 2, 2, 197, 200, 3, 2, 2, 2, 198, 196, 3, 2, 2, 2, 198, 199, 3, 2, 2, 2, 199, 17, 3, 2, 2, 2, 200, 198, 3, 2, 2, 2, 201, 202, 5, 20, 11, 2, 202, 203, 7, 21, 2, 2, 203, 204, 5, 4, 3, 2, 204, 19, 3, 2, 2, 2, 205, 206, 9, 8, 2, 2, 206, 21, 3, 2, 2, 2, 207, 213, 7, 46, 2, 2, 208, 213, 7, 47, 2, 2, 209, 213, 5, 24, 13, 2, 210, 213, 5, 26, 14, 2, 211, 213, 7, 49, 2, 2, 212, 207, 3, 2, 2, 2, 212, 208, 3, 2, 2, 2, 212, 209, 3, 2, 2, 2, 212, 210, 3, 2, 2, 2, 212, 211, 3, 2, 2, 2, 213, 23, 3, 2, 2, 2, 214, 215, 7, 52, 2, 2, 215, 25, 3, 2, 2, 2, 216, 217, 9, 9, 2, 2, 217, 27, 3, 2, 2, 2, 15, 46, 95, 98, 100, 150, 161, 172, 176, 180, 187, 191, 198, 212]
138+
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 59, 225, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 47, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 102, 10, 3, 3, 3, 7, 3, 105, 10, 3, 12, 3, 14, 3, 108, 11, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 157, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 7, 6, 166, 10, 6, 12, 6, 14, 6, 169, 11, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 177, 10, 7, 12, 7, 14, 7, 180, 11, 7, 3, 7, 5, 7, 183, 10, 7, 3, 7, 3, 7, 5, 7, 187, 10, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 194, 10, 8, 3, 8, 3, 8, 5, 8, 198, 10, 8, 3, 9, 3, 9, 3, 9, 7, 9, 203, 10, 9, 12, 9, 14, 9, 206, 11, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 219, 10, 12, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 2, 3, 4, 15, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 2, 10, 3, 2, 23, 25, 3, 2, 26, 29, 3, 2, 23, 24, 3, 2, 32, 35, 3, 2, 46, 47, 3, 2, 36, 37, 3, 2, 53, 54, 4, 2, 50, 50, 52, 52, 2, 253, 2, 28, 3, 2, 2, 2, 4, 46, 3, 2, 2, 2, 6, 156, 3, 2, 2, 2, 8, 158, 3, 2, 2, 2, 10, 162, 3, 2, 2, 2, 12, 186, 3, 2, 2, 2, 14, 197, 3, 2, 2, 2, 16, 199, 3, 2, 2, 2, 18, 207, 3, 2, 2, 2, 20, 211, 3, 2, 2, 2, 22, 218, 3, 2, 2, 2, 24, 220, 3, 2, 2, 2, 26, 222, 3, 2, 2, 2, 28, 29, 5, 4, 3, 2, 29, 30, 7, 2, 2, 3, 30, 3, 3, 2, 2, 2, 31, 32, 8, 3, 1, 2, 32, 33, 7, 22, 2, 2, 33, 47, 7, 53, 2, 2, 34, 47, 5, 6, 4, 2, 35, 36, 9, 2, 2, 2, 36, 47, 5, 4, 3, 22, 37, 47, 7, 53, 2, 2, 38, 47, 7, 38, 2, 2, 39, 47, 5, 22, 12, 2, 40, 47, 5, 12, 7, 2, 41, 47, 5, 14, 8, 2, 42, 43, 7, 13, 2, 2, 43, 44, 5, 4, 3, 2, 44, 45, 7, 14, 2, 2, 45, 47, 3, 2, 2, 2, 46, 31, 3, 2, 2, 2, 46, 34, 3, 2, 2, 2, 46, 35, 3, 2, 2, 2, 46, 37, 3, 2, 2, 2, 46, 38, 3, 2, 2, 2, 46, 39, 3, 2, 2, 2, 46, 40, 3, 2, 2, 2, 46, 41, 3, 2, 2, 2, 46, 42, 3, 2, 2, 2, 47, 106, 3, 2, 2, 2, 48, 49, 12, 21, 2, 2, 49, 50, 7, 3, 2, 2, 50, 105, 5, 4, 3, 22, 51, 52, 12, 20, 2, 2, 52, 53, 9, 3, 2, 2, 53, 105, 5, 4, 3, 21, 54, 55, 12, 19, 2, 2, 55, 56, 9, 4, 2, 2, 56, 105, 5, 4, 3, 20, 57, 58, 12, 18, 2, 2, 58, 59, 9, 5, 2, 2, 59, 105, 5, 4, 3, 19, 60, 61, 12, 17, 2, 2, 61, 62, 7, 42, 2, 2, 62, 105, 5, 4, 3, 18, 63, 64, 12, 16, 2, 2, 64, 65, 7, 43, 2, 2, 65, 105, 5, 4, 3, 17, 66, 67, 12, 15, 2, 2, 67, 68, 7, 44, 2, 2, 68, 105, 5, 4, 3, 16, 69, 70, 12, 14, 2, 2, 70, 71, 7, 45, 2, 2, 71, 105, 5, 4, 3, 15, 72, 73, 12, 13, 2, 2, 73, 74, 9, 6, 2, 2, 74, 105, 5, 4, 3, 14, 75, 76, 12, 12, 2, 2, 76, 77, 9, 7, 2, 2, 77, 105, 5, 4, 3, 13, 78, 79, 12, 11, 2, 2, 79, 80, 7, 39, 2, 2, 80, 105, 5, 4, 3, 12, 81, 82, 12, 10, 2, 2, 82, 83, 7, 40, 2, 2, 83, 105, 5, 4, 3, 11, 84, 85, 12, 9, 2, 2, 85, 86, 7, 20, 2, 2, 86, 87, 5, 4, 3, 2, 87, 88, 7, 21, 2, 2, 88, 89, 5, 4, 3, 10, 89, 105, 3, 2, 2, 2, 90, 91, 12, 26, 2, 2, 91, 92, 7, 11, 2, 2, 92, 93, 5, 4, 3, 2, 93, 94, 7, 12, 2, 2, 94, 105, 3, 2, 2, 2, 95, 96, 12, 25, 2, 2, 96, 97, 7, 22, 2, 2, 97, 105, 7, 53, 2, 2, 98, 99, 12, 23, 2, 2, 99, 101, 7, 13, 2, 2, 100, 102, 5, 10, 6, 2, 101, 100, 3, 2, 2, 2, 101, 102, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 105, 7, 14, 2, 2, 104, 48, 3, 2, 2, 2, 104, 51, 3, 2, 2, 2, 104, 54, 3, 2, 2, 2, 104, 57, 3, 2, 2, 2, 104, 60, 3, 2, 2, 2, 104, 63, 3, 2, 2, 2, 104, 66, 3, 2, 2, 2, 104, 69, 3, 2, 2, 2, 104, 72, 3, 2, 2, 2, 104, 75, 3, 2, 2, 2, 104, 78, 3, 2, 2, 2, 104, 81, 3, 2, 2, 2, 104, 84, 3, 2, 2, 2, 104, 90, 3, 2, 2, 2, 104, 95, 3, 2, 2, 2, 104, 98, 3, 2, 2, 2, 105, 108, 3, 2, 2, 2, 106, 104, 3, 2, 2, 2, 106, 107, 3, 2, 2, 2, 107, 5, 3, 2, 2, 2, 108, 106, 3, 2, 2, 2, 109, 110, 7, 4, 2, 2, 110, 111, 7, 13, 2, 2, 111, 112, 5, 4, 3, 2, 112, 113, 7, 14, 2, 2, 113, 157, 3, 2, 2, 2, 114, 115, 7, 5, 2, 2, 115, 116, 7, 13, 2, 2, 116, 117, 5, 4, 3, 2, 117, 118, 7, 18, 2, 2, 118, 119, 5, 8, 5, 2, 119, 120, 7, 14, 2, 2, 120, 157, 3, 2, 2, 2, 121, 122, 7, 6, 2, 2, 122, 123, 7, 13, 2, 2, 123, 124, 5, 4, 3, 2, 124, 125, 7, 18, 2, 2, 125, 126, 5, 8, 5, 2, 126, 127, 7, 14, 2, 2, 127, 157, 3, 2, 2, 2, 128, 129, 7, 7, 2, 2, 129, 130, 7, 13, 2, 2, 130, 131, 5, 4, 3, 2, 131, 132, 7, 18, 2, 2, 132, 133, 5, 8, 5, 2, 133, 134, 7, 14, 2, 2, 134, 157, 3, 2, 2, 2, 135, 136, 7, 8, 2, 2, 136, 137, 7, 13, 2, 2, 137, 138, 5, 4, 3, 2, 138, 139, 7, 18, 2, 2, 139, 140, 5, 8, 5, 2, 140, 141, 7, 14, 2, 2, 141, 157, 3, 2, 2, 2, 142, 143, 7, 9, 2, 2, 143, 144, 7, 13, 2, 2, 144, 145, 5, 4, 3, 2, 145, 146, 7, 18, 2, 2, 146, 147, 5, 8, 5, 2, 147, 148, 7, 14, 2, 2, 148, 157, 3, 2, 2, 2, 149, 150, 7, 10, 2, 2, 150, 151, 7, 13, 2, 2, 151, 152, 5, 4, 3, 2, 152, 153, 7, 18, 2, 2, 153, 154, 5, 8, 5, 2, 154, 155, 7, 14, 2, 2, 155, 157, 3, 2, 2, 2, 156, 109, 3, 2, 2, 2, 156, 114, 3, 2, 2, 2, 156, 121, 3, 2, 2, 2, 156, 128, 3, 2, 2, 2, 156, 135, 3, 2, 2, 2, 156, 142, 3, 2, 2, 2, 156, 149, 3, 2, 2, 2, 157, 7, 3, 2, 2, 2, 158, 159, 7, 15, 2, 2, 159, 160, 5, 4, 3, 2, 160, 161, 7, 16, 2, 2, 161, 9, 3, 2, 2, 2, 162, 167, 5, 4, 3, 2, 163, 164, 7, 18, 2, 2, 164, 166, 5, 4, 3, 2, 165, 163, 3, 2, 2, 2, 166, 169, 3, 2, 2, 2, 167, 165, 3, 2, 2, 2, 167, 168, 3, 2, 2, 2, 168, 11, 3, 2, 2, 2, 169, 167, 3, 2, 2, 2, 170, 171, 7, 11, 2, 2, 171, 187, 7, 12, 2, 2, 172, 173, 7, 11, 2, 2, 173, 178, 5, 4, 3, 2, 174, 175, 7, 18, 2, 2, 175, 177, 5, 4, 3, 2, 176, 174, 3, 2, 2, 2, 177, 180, 3, 2, 2, 2, 178, 176, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 182, 3, 2, 2, 2, 180, 178, 3, 2, 2, 2, 181, 183, 7, 18, 2, 2, 182, 181, 3, 2, 2, 2, 182, 183, 3, 2, 2, 2, 183, 184, 3, 2, 2, 2, 184, 185, 7, 12, 2, 2, 185, 187, 3, 2, 2, 2, 186, 170, 3, 2, 2, 2, 186, 172, 3, 2, 2, 2, 187, 13, 3, 2, 2, 2, 188, 189, 7, 15, 2, 2, 189, 198, 7, 16, 2, 2, 190, 191, 7, 15, 2, 2, 191, 193, 5, 16, 9, 2, 192, 194, 7, 18, 2, 2, 193, 192, 3, 2, 2, 2, 193, 194, 3, 2, 2, 2, 194, 195, 3, 2, 2, 2, 195, 196, 7, 16, 2, 2, 196, 198, 3, 2, 2, 2, 197, 188, 3, 2, 2, 2, 197, 190, 3, 2, 2, 2, 198, 15, 3, 2, 2, 2, 199, 204, 5, 18, 10, 2, 200, 201, 7, 18, 2, 2, 201, 203, 5, 18, 10, 2, 202, 200, 3, 2, 2, 2, 203, 206, 3, 2, 2, 2, 204, 202, 3, 2, 2, 2, 204, 205, 3, 2, 2, 2, 205, 17, 3, 2, 2, 2, 206, 204, 3, 2, 2, 2, 207, 208, 5, 20, 11, 2, 208, 209, 7, 21, 2, 2, 209, 210, 5, 4, 3, 2, 210, 19, 3, 2, 2, 2, 211, 212, 9, 8, 2, 2, 212, 21, 3, 2, 2, 2, 213, 219, 7, 48, 2, 2, 214, 219, 7, 49, 2, 2, 215, 219, 5, 24, 13, 2, 216, 219, 5, 26, 14, 2, 217, 219, 7, 51, 2, 2, 218, 213, 3, 2, 2, 2, 218, 214, 3, 2, 2, 2, 218, 215, 3, 2, 2, 2, 218, 216, 3, 2, 2, 2, 218, 217, 3, 2, 2, 2, 219, 23, 3, 2, 2, 2, 220, 221, 7, 54, 2, 2, 221, 25, 3, 2, 2, 2, 222, 223, 9, 9, 2, 2, 223, 27, 3, 2, 2, 2, 15, 46, 101, 104, 106, 156, 167, 178, 182, 186, 193, 197, 204, 218]

parser/gen/expr.tokens

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,24 @@ Pointer=36
3737
And=37
3838
Or=38
3939
Builtins=39
40-
Contains=40
41-
Matches=41
42-
In=42
43-
NotIn=43
44-
NilLiteral=44
45-
BooleanLiteral=45
46-
IntegerLiteral=46
47-
FloatLiteral=47
48-
HexIntegerLiteral=48
49-
Identifier=49
50-
StringLiteral=50
51-
WhiteSpaces=51
52-
MultiLineComment=52
53-
SingleLineComment=53
54-
LineTerminator=54
55-
UnexpectedCharacter=55
40+
StartsWith=40
41+
EndsWith=41
42+
Contains=42
43+
Matches=43
44+
In=44
45+
NotIn=45
46+
NilLiteral=46
47+
BooleanLiteral=47
48+
IntegerLiteral=48
49+
FloatLiteral=49
50+
HexIntegerLiteral=50
51+
Identifier=51
52+
StringLiteral=52
53+
WhiteSpaces=53
54+
MultiLineComment=54
55+
SingleLineComment=55
56+
LineTerminator=56
57+
UnexpectedCharacter=57
5658
'..'=1
5759
'len'=2
5860
'all'=3
@@ -88,8 +90,10 @@ UnexpectedCharacter=55
8890
'=='=34
8991
'!='=35
9092
'#'=36
91-
'contains'=40
92-
'matches'=41
93-
'in'=42
94-
'not in'=43
95-
'nil'=44
93+
'startsWith'=40
94+
'endsWith'=41
95+
'contains'=42
96+
'matches'=43
97+
'in'=44
98+
'not in'=45
99+
'nil'=46

parser/gen/exprLexer.interp

Lines changed: 7 additions & 1 deletion
Large diffs are not rendered by default.

parser/gen/exprLexer.tokens

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,24 @@ Pointer=36
3737
And=37
3838
Or=38
3939
Builtins=39
40-
Contains=40
41-
Matches=41
42-
In=42
43-
NotIn=43
44-
NilLiteral=44
45-
BooleanLiteral=45
46-
IntegerLiteral=46
47-
FloatLiteral=47
48-
HexIntegerLiteral=48
49-
Identifier=49
50-
StringLiteral=50
51-
WhiteSpaces=51
52-
MultiLineComment=52
53-
SingleLineComment=53
54-
LineTerminator=54
55-
UnexpectedCharacter=55
40+
StartsWith=40
41+
EndsWith=41
42+
Contains=42
43+
Matches=43
44+
In=44
45+
NotIn=45
46+
NilLiteral=46
47+
BooleanLiteral=47
48+
IntegerLiteral=48
49+
FloatLiteral=49
50+
HexIntegerLiteral=50
51+
Identifier=51
52+
StringLiteral=52
53+
WhiteSpaces=53
54+
MultiLineComment=54
55+
SingleLineComment=55
56+
LineTerminator=56
57+
UnexpectedCharacter=57
5658
'..'=1
5759
'len'=2
5860
'all'=3
@@ -88,8 +90,10 @@ UnexpectedCharacter=55
8890
'=='=34
8991
'!='=35
9092
'#'=36
91-
'contains'=40
92-
'matches'=41
93-
'in'=42
94-
'not in'=43
95-
'nil'=44
93+
'startsWith'=40
94+
'endsWith'=41
95+
'contains'=42
96+
'matches'=43
97+
'in'=44
98+
'not in'=45
99+
'nil'=46

parser/gen/expr_base_listener.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/gen/expr_base_visitor.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)