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
{{ message }}
Repository navigation
ccc, cccx, nativeparser: the power operator ^ is not parsed #55
Measured on 06.11.2026 with the parser snapshots of main (ccc, cccx) and parser.nativeparser built at 212a87e.
#
MDX
ccc
cccx
nativeparser
1
WITH MEMBER [Measures].[A] AS 2 ^ 3 SELECT {[Measures].[A]} ON 0 FROM [Sales]
Found string "^" of type INVALID at 1:33
same
same
2
SELECT {[Measures].[A]} ON 0 FROM [Sales] WHERE ([Measures].[Sales] / 1000) ^ 2
same at 1:77
same
same
No grammar declares a token for ^: parser.ccc/src/main/ccc/Grammer.ccc has ASTERISK, SOLIDUS, PLUS, MINUS and CONCAT for the arithmetic, so the lexer reads ^ as INVALID.
Why it matters
Analysis Services evaluates ^ as the power operator. Two public servers (SQL Server Analysis Services, multidimensional, Adventure Works) answer alike:
expression
answer
reads as
2 ^ 3 ^ 2
512
2 ^ (3 ^ 2): from right to left
2 ^ 2 * 3
12
(2 ^ 2) * 3
2 * 3 ^ 2
18
2 * (3 ^ 2)
12 / 2 ^ 2
3
12 / (2 ^ 2)
-2 ^ 2
-4
-(2 ^ 2): the sign applies to the power
2 ^ -1
0.5
the exponent may carry a sign
2 ^ 0.5
1.4142135623730951
NULL ^ 2
0
(evaluation, listed for the side that evaluates the operator)
Wished result
a token ^ in ccc, cccx and nativeparser;
^ binds tighter than * and / and tighter than a leading sign, groups from right to left, and takes a signed operand on its right;
the parsed form an infix call of the operator ^, as * is, so that the unparser writes it back.
Activity