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

infix:<xx> #109

Closed
p6rt opened this issue May 26, 2008 · 4 comments
Closed

infix:<xx> #109

p6rt opened this issue May 26, 2008 · 4 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented May 26, 2008

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

Searchable as RT54870$

@p6rt
Copy link
Author

@p6rt p6rt commented May 26, 2008

From olivier.mengue@gmail.com

Here is a patch for operator infix​:<xx>.

Added the operator to the grammar.
Updated the PIR. Here is what I get​:
  my @​a = (1,2,"a") xx 4; say @​a.perl;
  [1, 2, a, 1, 2, a, 1, 2, a, 1, 2, a]
Needs more work for slice context and infinite count.

Olivier (dolmen).

@p6rt
Copy link
Author

@p6rt p6rt commented May 26, 2008

From olivier.mengue@gmail.com

infix-xx.patch
Index: src/builtins/op.pir
===================================================================
--- src/builtins/op.pir	(révision 27823)
+++ src/builtins/op.pir	(copie de travail)
@@ -186,14 +186,14 @@
 
 
 .sub 'infix:xx' :multi(_,_)
-    .param string a
-    .param int b
-    $P0 = new 'ResizablePMCArray'
+    .param pmc a
+    .param int n
+    $P0 = 'list'()
   lp:
-    unless b, ex
+    unless n goto ex
     push $P0, a
-    dec b
-    branch lp
+    dec n
+    goto lp
   ex:
     .return ($P0)
 .end
Index: src/parser/grammar-oper.pg
===================================================================
--- src/parser/grammar-oper.pg	(révision 27823)
+++ src/parser/grammar-oper.pg	(copie de travail)
@@ -49,6 +49,8 @@
 
 ## replication
 proto infix:<x> is precedence('s=') { ... }
+proto infix:<xx> is equiv(infix:<x>)
+    { ... }
 
 ## concatenation
 proto infix:<~> is precedence('r=') { ... }

@p6rt
Copy link
Author

@p6rt p6rt commented May 27, 2008

From @pmichaud

Applied (with minor changes) in r27835, thanks!

Pm

@p6rt p6rt closed this May 27, 2008
@p6rt
Copy link
Author

@p6rt p6rt commented May 27, 2008

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

@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant