mention set literals in the specification

This commit is contained in:
Philip Ginsbach
2020-03-26 12:21:38 +00:00
committed by GitHub
parent 0f70da2258
commit 783cee30c4

View File

@@ -1168,6 +1168,17 @@ If both expressions are subtypes of ``int`` then the type of the range is ``int`
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.
Set Literals
~~~~~~~~~~~~
Set literals denote a choice from a collection of values.
::
setliteral ::= "[" expr ("," expr)* "]"
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.
Disambiguation of expressions
-----------------------------
@@ -1934,6 +1945,7 @@ The complete grammar for QL is as follows:
| aggregation
| any
| range
| setliteral
eparen ::= "(" expr ")"
@@ -1973,6 +1985,8 @@ The complete grammar for QL is as follows:
| primary "." predicateName (closure)? "(" (exprs)? ")"
range ::= "[" expr ".." expr "]"
setliteral ::= "[" expr ("," expr)* "]"
simpleId ::= lowerId | upperId