NASL2 new operators & precedence

Michel Arboi <[email protected]>
Newsgroups gmane.comp.security.nessus.devel
Organization Compilo ergo sum
Message-ID <[email protected]>
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

-- 
mailto:[email protected]
GPG Public keys: http://michel.arboi.free.fr/pubkey.txt
http://michel.arboi.free.fr/	http://arboi.da.ru/
FAQNOPI de fr.comp.securite : http://faqnopi.da.ru/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.