[OpenSIPS-Devel] [OpenSIPS/opensips] 9cd4be: cfg syntax: Disallow esoteric if/while syntax
Liviu Chircu
noreply at github.com
Tue Jul 30 14:14:23 EDT 2019
Branch: refs/heads/feature/improve-cfg-syntax
Home: https://github.com/OpenSIPS/opensips
Commit: 9cd4be4a2abf29f8eee673f56c048401bed9a511
https://github.com/OpenSIPS/opensips/commit/9cd4be4a2abf29f8eee673f56c048401bed9a511
Author: Liviu Chircu <liviu at opensips.org>
Date: 2019-07-30 (Tue, 30 Jul 2019)
Changed paths:
M cfg.y
Log Message:
-----------
cfg syntax: Disallow esoteric if/while syntax
The opensips.cfg no longer accepts constructs such as:
if $var(foo) {
...
}
if [ $var(foo) == 2 ]
xlog("bar\n");
while $var(foo) < 10 {
...
}
... and forces the condition to be paranthesized. Aside from any
consistency considerations, this change also allows us to disambiguate
the if-if-else shift/reduce conflicts of the grammar, which were so far
masked using the "expect 2" rule.
Commit: 1a4498b8d133db2b8d3ecdc9e36d99543edb08c8
https://github.com/OpenSIPS/opensips/commit/1a4498b8d133db2b8d3ecdc9e36d99543edb08c8
Author: Liviu Chircu <liviu at opensips.org>
Date: 2019-07-30 (Tue, 30 Jul 2019)
Changed paths:
M cfg.y
Log Message:
-----------
cfg syntax: Enhance the 'return' statement
The opensips.cfg now additionally allows syntax such as:
* return 1;
* return +2;
* return -3;
* return $var(foo);
Commit: 6a97f68100e669cf6ceec53c073351d0bd07ebe2
https://github.com/OpenSIPS/opensips/commit/6a97f68100e669cf6ceec53c073351d0bd07ebe2
Author: Liviu Chircu <liviu at opensips.org>
Date: 2019-07-30 (Tue, 30 Jul 2019)
Changed paths:
M action.c
M route_struct.h
Log Message:
-----------
cfg syntax: Fix all complex assignment operators
The opensips.cfg now fully supports the non-trivial assignment
operators, such as: +=, -=, *=, /=, %=, &=, |= and ^=. Syntactially,
they were supported until now, but were actually unimplemented (more
precisely, they were equivalent to the "=" operator).
Only the "+=" operator can also work with strings, for example:
$var(x) = "foo";
$var(x) += "-bar"; # now contains "foo-bar"
$rU = "+40";
$rU += "729" + "884950"; # now contains "+40729884950"
All of them (including "+="), work with integers:
$var(i) = 0;
$var(i) += 2; # 2
$var(i) *= 3; # 6
$var(i) /= 6; # 1
...
Compare: https://github.com/OpenSIPS/opensips/compare/71fef1149516...6a97f68100e6
More information about the Devel
mailing list