ANTLR 4 implementation of the RESO RCP-019 grammar, with backwards-compatibility support for RETS 1.9 Validation Expressions.
-
Basic arithmetic
3 + 5
-
Bracketed RETSNAMEs
[ListPrice] > 0
-
RCP61 added support for unbracketed RETSNAMEs
ListPrice > 0
-
To get current value of any field, just use the
DICTNAME
of that field
ListPrice
-
RETS had support for the LAST keyword, which now works on all fields
to get the old value
LAST Status != "Sold"
-
Which is useful for field change detection
ListPrice != LAST ListPrice
-
Function calls are also supported, as long as they don't use
any of the RETSNAME keywords
foo()
foo ('bar', 'baz', 42)
-
Lists of expressions are also supported
(ListPrice, Status, 3+5, LAST Status, (1, 2, 3))
-
Supports complex expressions with grouping
ListPrice > 5.01 .AND. (1, 2, 3) .CONTAINS. 3 .OR. (Status .IN. ('Active', 'Pending') .AND. .USERLEVEL. != "Admin")
-
Which parses differently than
ListPrice > 5.01 .AND. (1, 2, 3) .CONTAINS. 3 .OR. Status .IN. ('Active', 'Pending') .AND. .USERLEVEL. != "Admin"
- RCP-019.1 added support for
collections
which includeLIST()
andSET()
. These functions take 0 or more items. Backwards compatibility with the previous list syntax of()
has been preserved.
Expression | Result | Comments |
---|---|---|
LIST(1, 2, 2, 3) |
LIST(1, 2, 2, 3 |
Duplicate items are preserved. |
SET(1, 2, 2, 3) |
SET(1, 2, 3) |
Duplicate items are removed. |
- RCP-019.1 also added support for
DIFFERENCE()
,INTERSECTION()
, andUNION()
, which are intended to produce types in the following manner:- Operations on homogeneous collections of
LIST()
orSET()
should returnLIST()
orSET()
, respectively. For example,UNION(LIST('a', 'b', 3+5), LIST(6))
should returnLIST('a', 'b', 6, 8)
. - Operations on heterogenous collections of
LIST()
orSET()
, for instanceDIFFERENCE(LIST(1, 2, 3), SET(3))
should returnLIST()
.
- Operations on homogeneous collections of
These special functions require at least two arguments of type LIST()
or SET()
Expression | Result | Comments |
---|---|---|
DIFFERENCE(LIST(1, 2, 3), LIST(1, 2)) |
LIST(3) |
Collection operators require two or more LIST() or SET() arguments. |
UNION(LIST(1, 2), SET(3)) |
LIST(1, 2, 3) |
Arguments of type LIST() are converted to SET() . |
INTERSECTION(SET(DIFFERENCE(LIST(1, 2, 3), SET(1))), SET(2)) |
SET(2) |
Since the return type of collection operators is SET() or LIST() , they can be composed. |