Skip to content

Commit 20f114d

Browse files
authored
Merge pull request #179 from biscuit-auth/empty-set-literals
document the empty set literal
2 parents 3ac8c50 + ca26dbc commit 20f114d

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

SPECIFICATIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ We will represent the various types as follows:
121121
- date in RFC 3339 format: `1985-04-12T23:20:50.52Z`
122122
- boolean: `true` or `false`
123123
- null: `null`, supported since v3.3
124-
- set: `{ "a", "b", "c"}`
124+
- set: `{"a", "b", "c"}` (the empty set is `{,}`)
125125
- array: `[ "a", true, null]`, supported since v3.3
126-
- map: `{ "a": true, 12: "a" }`, supported since v3.3
126+
- map: `{ "a": true, 12: "a" }` (the empty map is `{}`), supported since v3.3
127127

128128
As an example, assuming we have the following facts: `parent("a", "b")`,
129129
`parent("b", "c")`, `parent("c", "d")`. If we apply the rule
@@ -205,7 +205,7 @@ The logic language is described by the following EBNF grammar:
205205
<boolean> ::= "true" | "false"
206206
<null> ::= "null"
207207
<date> ::= [0-9]* "-" [0-9] [0-9] "-" [0-9] [0-9] "T" [0-9] [0-9] ":" [0-9] [0-9] ":" [0-9] [0-9] ( "Z" | ( ("+" | "-") [0-9] [0-9] ":" [0-9] [0-9] ))
208-
<set> ::= "{" <sp>? ( <set_term> ( <sp>? "," <sp>? <set_term>)* <sp>? )? "}"
208+
<set> ::= "{" "," | (<sp>? ( <set_term> ( <sp>? "," <sp>? <set_term>)* <sp>? ) )"}"
209209
<array> ::= "[" <sp>? ( <term> ( <sp>? "," <sp>? <term>)* <sp>? )? "]"
210210
<map_entry> ::= (<string> | <number>) <sp>? ":" <sp>? <term>
211211
<map> ::= "{" <sp>? ( <map_entry> ( <sp>? "," <sp>? <map_entry>)* <sp>? )? "}"

samples/current/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ check if {1, 2}.intersection({2, 3}) === {2};
13211321
check if {1, 2}.union({2, 3}) === {1, 2, 3};
13221322
check if {1, 2, 3}.intersection({1, 2}).contains(1);
13231323
check if {1, 2, 3}.intersection({1, 2}).length() === 2;
1324+
check if {,}.length() === 0;
13241325
```
13251326

13261327
### validation
@@ -1331,7 +1332,7 @@ allow if true;
13311332
```
13321333

13331334
revocation ids:
1334-
- `d0420227266e3583a42dfaa0e38550d99f681d150dd18856f3af9a697bc9c5c8bf06b4b0fe5b9df0377d1b963574e2fd210a0a76a8b0756a65f640c602bebd07`
1335+
- `fa358e4e3bea896415b1859e6cd347e64e1918fb86e31ae3fe208628321576a47f7a269760357e291c827ec9cbe322074f6860a546207a64e133c83a214bb505`
13351336

13361337
authorizer world:
13371338
```
@@ -1372,6 +1373,7 @@ World {
13721373
"check if true",
13731374
"check if true === true",
13741375
"check if {\"abc\", \"def\"}.contains(\"abc\")",
1376+
"check if {,}.length() === 0",
13751377
"check if {1, 2, 3}.intersection({1, 2}).contains(1)",
13761378
"check if {1, 2, 3}.intersection({1, 2}).length() === 2",
13771379
"check if {1, 2} === {1, 2}",

samples/current/samples.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@
12761276
],
12771277
"public_keys": [],
12781278
"external_key": null,
1279-
"code": "check if true;\ncheck if !false;\ncheck if true === true;\ncheck if false === false;\ncheck if 1 < 2;\ncheck if 2 > 1;\ncheck if 1 <= 2;\ncheck if 1 <= 1;\ncheck if 2 >= 1;\ncheck if 2 >= 2;\ncheck if 3 === 3;\ncheck if 1 + 2 * 3 - 4 / 2 === 5;\ncheck if \"hello world\".starts_with(\"hello\"), \"hello world\".ends_with(\"world\");\ncheck if \"aaabde\".matches(\"a*c?.e\");\ncheck if \"aaabde\".contains(\"abd\");\ncheck if \"aaabde\" === \"aaa\" + \"b\" + \"de\";\ncheck if \"abcD12\" === \"abcD12\";\ncheck if \"abcD12\".length() === 6;\ncheck if \"é\".length() === 2;\ncheck if 2019-12-04T09:46:41Z < 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z > 2019-12-04T09:46:41Z;\ncheck if 2019-12-04T09:46:41Z <= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2019-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z === 2020-12-04T09:46:41Z;\ncheck if hex:12ab === hex:12ab;\ncheck if {1, 2}.contains(2);\ncheck if {2019-12-04T09:46:41Z, 2020-12-04T09:46:41Z}.contains(2020-12-04T09:46:41Z);\ncheck if {false, true}.contains(true);\ncheck if {\"abc\", \"def\"}.contains(\"abc\");\ncheck if {hex:12ab, hex:34de}.contains(hex:34de);\ncheck if {1, 2}.contains({2});\ncheck if {1, 2} === {1, 2};\ncheck if {1, 2}.intersection({2, 3}) === {2};\ncheck if {1, 2}.union({2, 3}) === {1, 2, 3};\ncheck if {1, 2, 3}.intersection({1, 2}).contains(1);\ncheck if {1, 2, 3}.intersection({1, 2}).length() === 2;\n",
1279+
"code": "check if true;\ncheck if !false;\ncheck if true === true;\ncheck if false === false;\ncheck if 1 < 2;\ncheck if 2 > 1;\ncheck if 1 <= 2;\ncheck if 1 <= 1;\ncheck if 2 >= 1;\ncheck if 2 >= 2;\ncheck if 3 === 3;\ncheck if 1 + 2 * 3 - 4 / 2 === 5;\ncheck if \"hello world\".starts_with(\"hello\"), \"hello world\".ends_with(\"world\");\ncheck if \"aaabde\".matches(\"a*c?.e\");\ncheck if \"aaabde\".contains(\"abd\");\ncheck if \"aaabde\" === \"aaa\" + \"b\" + \"de\";\ncheck if \"abcD12\" === \"abcD12\";\ncheck if \"abcD12\".length() === 6;\ncheck if \"é\".length() === 2;\ncheck if 2019-12-04T09:46:41Z < 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z > 2019-12-04T09:46:41Z;\ncheck if 2019-12-04T09:46:41Z <= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2019-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z >= 2020-12-04T09:46:41Z;\ncheck if 2020-12-04T09:46:41Z === 2020-12-04T09:46:41Z;\ncheck if hex:12ab === hex:12ab;\ncheck if {1, 2}.contains(2);\ncheck if {2019-12-04T09:46:41Z, 2020-12-04T09:46:41Z}.contains(2020-12-04T09:46:41Z);\ncheck if {false, true}.contains(true);\ncheck if {\"abc\", \"def\"}.contains(\"abc\");\ncheck if {hex:12ab, hex:34de}.contains(hex:34de);\ncheck if {1, 2}.contains({2});\ncheck if {1, 2} === {1, 2};\ncheck if {1, 2}.intersection({2, 3}) === {2};\ncheck if {1, 2}.union({2, 3}) === {1, 2, 3};\ncheck if {1, 2, 3}.intersection({1, 2}).contains(1);\ncheck if {1, 2, 3}.intersection({1, 2}).length() === 2;\ncheck if {,}.length() === 0;\n",
12801280
"version": 3
12811281
}
12821282
],
@@ -1317,6 +1317,7 @@
13171317
"check if true",
13181318
"check if true === true",
13191319
"check if {\"abc\", \"def\"}.contains(\"abc\")",
1320+
"check if {,}.length() === 0",
13201321
"check if {1, 2, 3}.intersection({1, 2}).contains(1)",
13211322
"check if {1, 2, 3}.intersection({1, 2}).length() === 2",
13221323
"check if {1, 2} === {1, 2}",
@@ -1339,7 +1340,7 @@
13391340
},
13401341
"authorizer_code": "allow if true;\n",
13411342
"revocation_ids": [
1342-
"d0420227266e3583a42dfaa0e38550d99f681d150dd18856f3af9a697bc9c5c8bf06b4b0fe5b9df0377d1b963574e2fd210a0a76a8b0756a65f640c602bebd07"
1343+
"fa358e4e3bea896415b1859e6cd347e64e1918fb86e31ae3fe208628321576a47f7a269760357e291c827ec9cbe322074f6860a546207a64e133c83a214bb505"
13431344
]
13441345
}
13451346
}
34 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)