You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VCC should parse a literal negative number such as -10 where an INT is expected.
The C typedef for VCL_INT is (signed) long, so it's not a problem with the data type, just the parser.
Current Behavior
When VCC sees -, it emits this error message and fails the parse:
Message from VCC-compiler: Unknown token '-' when looking for INT
Both of these workarounds will get a negative value into the INT:
std.integer("-10", 0)
0 - 1 # i.e. 1 subtracted from 0
std.integer("-10", -10) doesn't work, because INT is specified for the fallback parameter, so the same error is raised.
Possible Solution
If I'm reading the VCC code right, it looks like the CNUM type will have to permit the expression to begin with -. And it that case the conversion will have to negate the result of vcc_UintVal(), which currently returns unsigned (and the comments say that it expects digits only).
Steps to Reproduce (for bugs)
Use a negative literal in VCL at any position where INT is expected.
Context
VMOD development, but this is a general VCL issue.
Your Environment
Varnish trunk (but the problem has presumably always been there)
The text was updated successfully, but these errors were encountered:
Expected Behavior
VCC should parse a literal negative number such as
-10
where an INT is expected.The C typedef for VCL_INT is (signed) long, so it's not a problem with the data type, just the parser.
Current Behavior
When VCC sees
-
, it emits this error message and fails the parse:Both of these workarounds will get a negative value into the INT:
std.integer("-10", -10)
doesn't work, because INT is specified for the fallback parameter, so the same error is raised.Possible Solution
If I'm reading the VCC code right, it looks like the CNUM type will have to permit the expression to begin with
-
. And it that case the conversion will have to negate the result ofvcc_UintVal()
, which currently returns unsigned (and the comments say that it expects digits only).Steps to Reproduce (for bugs)
Use a negative literal in VCL at any position where INT is expected.
Context
VMOD development, but this is a general VCL issue.
Your Environment
Varnish trunk (but the problem has presumably always been there)
The text was updated successfully, but these errors were encountered: