Refiner language grammar

Refiner functions process data and extract text in the Refiner step of a Flow. Refiner functions are one part of the Refiner grammar that makes up the Instabase Refiner language. Refiner language grammar requires strict adherence to these syntax rules. In-product documentation and examples of are available for each Refiner function.

Uppercase and lowercase

  • Functions are case-insensitive
  • INPUT_COL is a case-sensitive reserved keyword

Operators

The Refiner language supports the following types of operators: Boolean, binary, unary.

Boolean (logical) operators

Returns keywords: true or false

Binary operators

A binary operator requires two operands, one before the operator and one after the operator.

Operator Function Example
+ addition 1 + 2
- subtraction 8 - 6
* multiplication 12 * 3
/ division 96 / 4
== equality arg1 == arg2
<> inequality arg1 <> arg2
> greater than arg1 > arg2
< less than arg1 < arg2
<= less than or equal to arg1 <= arg2
and logical arg1 and arg2
or logical arg1 and arg2

Unary operators

A unary operation is an operation with only one operand. The standard unary operators are:

Operator Type Example
+ addition +x
- subtraction -y
! inequality !2

Precedence levels and parentheses

Operator precedence is not used by Refiner functions. However, you can use parentheses for grouping to denote precedence.

For example: (-1) + 2

Strings

Wrap strings in single quotation marks.

For example: 'This is a string'

Variable names

Variable names can contain only ASCII characters, numbers, and underscores.

For example: my_function(variable1, variable2)

Arrays

An array is a collection of values of the same type.

  • Enclose arrays in square brackets
  • Separate array elements with commas

For example: [1, 2, 3]

Refiner language grammar definition

The Refiner grammar definition code:

expr     = biexpr / unexpr / value
biexpr   = value ws binaryop ws expr
unexpr   = unaryop expr
value    = parenval /
           number /
           boolean /
           function /
           array /
           string /
           attr
parenval = "(" ws expr ws ")"
function = fname "(" ws arg_list? ws ")"
arg_list = expr (ws "," ws expr)*
number   = ~"\d*\.?\d+"i
array    = (~"'\[" ws expr (ws "," ws expr)* ws ~"\]'") / (~"\[" ws expr (ws "," ws expr)* ws ~"\]")
string   = ~r"'([^\\']|\\.)*'"i
attr     = ~"\w[\w\d]*"i
fname    = ~"\w[\w\d_]*"i
boolean  = "true" / "false"
binaryop = "+" / "-" / "*" / "/" / "==" / "<>" /
           "<=" / ">" / "<" / "=" / "and" / "or"
unaryop  = "+" / "-" / "!"
ws       = ~"\s*"i
wsp      = ~"\s+"i