Skip to content

Commit 7914470

Browse files
authored
feat: add support for filter operator functions (#289)
1 parent 317ba8d commit 7914470

File tree

31 files changed

+1054
-252
lines changed

31 files changed

+1054
-252
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ env:
88
DO_NOT_TRACK: '1'
99

1010
on:
11-
push:
12-
branches: ['dev', 'main', 'canary']
1311
pull_request:
1412
branches: ['dev', 'main', 'canary']
1513

1614
jobs:
1715
build-test:
18-
runs-on: ubuntu-latest
16+
runs-on: buildjet-4vcpu-ubuntu-2204
1917

2018
strategy:
2119
matrix:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zenstack-monorepo",
3-
"version": "1.0.0-alpha.81",
3+
"version": "1.0.0-alpha.82",
44
"description": "",
55
"scripts": {
66
"build": "pnpm -r build",

packages/language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/language",
3-
"version": "1.0.0-alpha.81",
3+
"version": "1.0.0-alpha.82",
44
"displayName": "ZenStack modeling language compiler",
55
"description": "ZenStack modeling language compiler",
66
"homepage": "https://zenstack.dev",

packages/language/src/ast.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export const BinaryExprOperatorPriority: Record<BinaryExpr['operator'], number>
2828
'<': 3,
2929
'>=': 3,
3030
'<=': 3,
31+
in: 4,
3132
//CollectionPredicateExpr
32-
'^': 4,
33-
'?': 4,
34-
'!': 4,
33+
'^': 5,
34+
'?': 5,
35+
'!': 5,
3536
};
3637

3738
declare module './generated/ast' {

packages/language/src/generated/ast.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export interface BinaryExpr extends AstNode {
150150
readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | FieldInitializer | FunctionDecl | GeneratorField | MemberAccessExpr | PluginField | UnaryExpr;
151151
readonly $type: 'BinaryExpr';
152152
left: Expression
153-
operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | '||'
153+
operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | 'in' | '||'
154154
right: Expression
155155
}
156156

@@ -318,6 +318,7 @@ export interface FunctionParam extends AstNode {
318318
readonly $container: DataModel | Enum | FunctionDecl;
319319
readonly $type: 'FunctionParam';
320320
name: string
321+
optional: boolean
321322
type: FunctionParamType
322323
}
323324

@@ -752,6 +753,14 @@ export class ZModelAstReflection extends AbstractAstReflection {
752753
]
753754
};
754755
}
756+
case 'FunctionParam': {
757+
return {
758+
name: 'FunctionParam',
759+
mandatory: [
760+
{ name: 'optional', type: 'boolean' }
761+
]
762+
};
763+
}
755764
case 'FunctionParamType': {
756765
return {
757766
name: 'FunctionParamType',

0 commit comments

Comments
 (0)