Pragmas
Pragmas control various language features and appear in a declaration block so their effect is lexically scoped. They have the form
pragma <id> = <expr>
where <id> is an identifier
and <expr> is a constant expression
that must evaluate at compile time without referencing any
runtime state such as this or a field of this.
Pragmas must appear in the declaration section of a scope.
List of Pragmas
Currently, there is just one supported pragma.
index_base- controls whether index expressions and slice expressions are 0-based or 1-based.0for zero-based indexing1for one-based indexing
Example
Controlling indexing and slicing
# spq
pragma index_base = 1
values {
a: this[2:3],
b: (
pragma index_base = 0
values this[0]
)
}
# input
"bar"
[1,2,3]
# expected output
{a:"a",b:error("missing")}
{a:[2],b:1}