# New Ticket Created by "Olivier Mengué" # Please include the string: [perl #54946] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54946 >
Added operators in grammar : - non-inclusive range: ..^ ^.. ^..^ - binding test: =:= - negated relational: !== !eq !~~ !=== (Note: This is probably not the good implementation of the negated relationals in the long term. A more generic '!' applied to any relational operator would be better as it could be immediately applied to any added relational op.) Trivial implementation of !eq, !== with cut 'n paste. dolmen.
Index: src/builtins/cmp.pir =================================================================== --- src/builtins/cmp.pir (révision 27854) +++ src/builtins/cmp.pir (copie de travail) @@ -20,6 +20,14 @@ .end +.sub 'infix:!==' :multi(_,_) + .param num a + .param num b + $I0 = isne a, b + .return 'prefix:?'($I0) +.end + +# Shortcut for infix:!==, so same code .sub 'infix:!=' :multi(_,_) .param num a .param num b @@ -75,7 +83,14 @@ .return 'prefix:?'($I0) .end +.sub 'infix:!eq' :multi(_,_) + .param string a + .param string b + $I0 = isne a, b + .return 'prefix:?'($I0) +.end + .sub 'infix:ne' :multi(_,_) .param string a .param string b Index: src/parser/grammar-oper.pg =================================================================== --- src/parser/grammar-oper.pg (révision 27854) +++ src/parser/grammar-oper.pg (copie de travail) @@ -76,25 +76,34 @@ ## nonchaining proto infix:<..> is precedence('n=') { ... } +proto infix:<..^> is equiv(infix:<..>) { ... } +proto infix:<^..> is equiv(infix:<..>) { ... } +proto infix:<^..^> is equiv(infix:<..>) { ... } proto infix:«<=>» is equiv(infix:<..>) { ... } proto infix:<cmp> is equiv(infix:<..>) { ... } proto infix:<leg> is equiv(infix:<..>) { ... } +proto infix:<=:=> is equiv(infix:<..>) { ... } +proto infix:<!=:=> is equiv(infix:<..>) { ... } ## chaining proto infix:<==> is precedence('m=') is pasttype('chain') { ... } proto infix:<!=> is equiv(infix:<==>) is pasttype('chain') { ... } +proto infix:<!==> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:«<» is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:«<=» is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:«>» is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:«>=» is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<eq> is equiv(infix:<==>) is pasttype('chain') { ... } +proto infix:<!eq> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<ne> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<lt> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<le> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<gt> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<ge> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<~~> is equiv(infix:<==>) is pasttype('chain') { ... } +proto infix:<!~~> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<===> is equiv(infix:<==>) is pasttype('chain') { ... } +proto infix:<!===> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<eqv> is equiv(infix:<==>) is pasttype('chain') { ... } proto infix:<!eqv> is equiv(infix:<==>) is pasttype('chain') { ... }