Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more operators in grammar, implemented !==, !eq #110

Closed
p6rt opened this issue May 28, 2008 · 6 comments
Closed

more operators in grammar, implemented !==, !eq #110

p6rt opened this issue May 28, 2008 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 28, 2008

Migrated from rt.perl.org#54946 (status was 'resolved')

Searchable as RT54946$

@p6rt
Copy link
Author

p6rt commented May 28, 2008

From olivier.mengue@gmail.com

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.

@p6rt
Copy link
Author

p6rt commented May 28, 2008

From olivier.mengue@gmail.com

more-ops.patch
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') { ... }
 

@p6rt
Copy link
Author

p6rt commented May 28, 2008

From @moritz

Olivier MenguXX (via RT) wrote​:

# 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​: ..^ ^.. ^..^

ISTR that the current policy is to parse only the things that are
implemented in the compiler.

(should I submit a patch for README with a few more commit policies? or
a separate document?

Cheers,
Moritz

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented May 28, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 28, 2008

From @pmichaud

On Wed May 28 03​:34​:35 2008, moritz@​casella.verplant.org wrote​:

ISTR that the current policy is to parse only the things that are
implemented in the compiler.

If that's been the policy, I guess we should probably change it.
Parsing additional constructs should probably be okay, as long as the
error message that results indicates somehow that this is an
unimplemented feature.

In this specific case, using one of the parsed-but-unimplemented
operators results in an error like "Could not invoke non-existent sub
infix​:^..", which I think is probably okay for now.

Patch applied, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented May 28, 2008

@pmichaud - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed May 28, 2008
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant