Re: NASL2 new operators & precedence
Richard Moore <[email protected]>
| Newsgroups | gmane.comp.security.nessus.devel |
|---|---|
| Message-ID | <[email protected]> |
Is this change likely to affect the semantics of any of the existing NASL scripts? I'm wondering if there are any that rely on the old left-to-right ordering. Cheers Rich. Michel Arboi wrote: > I add three new operators: > ** is the integer power (Fortran syntax) > ^ is the logical xor > >>>>is the unsigned / logical right shift (Java syntax) >>> >>> is now the signed right shift >> > (and by the way, there is no such thing as singed / unsigned left > shift :) > I also added %= which was missing > > Here is the precedence I implemented now (from lower priority to > higher): > %right = += -= *= /= %= <<= >>= >>>= > %left || > %left && > %nonassoc < > == != >= <= >< > %left | > %left ^ > %left & > %nonassoc >> >>> << > %left + - > %left * / % > %left - (unary minus) ~ > %right ** > %nonassoc ++ -- > > > I know that this precedence is not like > - C; but C precedence really sucks > - Java; but you cannot imagine how much I hate this language and the > marketing s** around it > - Perl; but so many Perl operators are missing (and, or, etc.) > > %nonassoc means that those constructions are rejected: > x << y << z > ++ x ++ > x ++ ++ > x > y > z > "a" >< str >< "b" > > %right means that 2**3**2 is parsed as 2**(3**2) = 2**9 and not > (2**3)**2 = 8**2 > -- Richard Moore, Principle Software Engineer Westpoint Ltd.