Skip to content

Commit 783cee3

Browse files
authored
mention set literals in the specification
1 parent 0f70da2 commit 783cee3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/language/ql-spec/language.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,17 @@ If both expressions are subtypes of ``int`` then the type of the range is ``int`
11681168

11691169
The values of a range expression are those values which are ordered inclusively between a value of the first expression and a value of the second expression.
11701170

1171+
Set Literals
1172+
~~~~~~~~~~~~
1173+
1174+
Set literals denote a choice from a collection of values.
1175+
1176+
::
1177+
1178+
setliteral ::= "[" expr ("," expr)* "]"
1179+
1180+
Set literals can be of any type, but the types within a set literal have to be consistent according to the following criterion: At least one of the set elements has to be of a type that is a supertype of all the set element types. This supertype is the type of the set literal. For example, ``float`` is a supertype of ``float`` and ``int``, therefore ``x = [4, 5.6]`` is valid. On the other hand, ``y = [5, "test"]`` does not adhere to the criterion.
1181+
11711182
Disambiguation of expressions
11721183
-----------------------------
11731184

@@ -1934,6 +1945,7 @@ The complete grammar for QL is as follows:
19341945
| aggregation
19351946
| any
19361947
| range
1948+
| setliteral
19371949

19381950
eparen ::= "(" expr ")"
19391951

@@ -1973,6 +1985,8 @@ The complete grammar for QL is as follows:
19731985
| primary "." predicateName (closure)? "(" (exprs)? ")"
19741986
19751987
range ::= "[" expr ".." expr "]"
1988+
1989+
setliteral ::= "[" expr ("," expr)* "]"
19761990

19771991
simpleId ::= lowerId | upperId
19781992

0 commit comments

Comments
 (0)