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

simple match() implementation #168

Closed
p6rt opened this issue Jul 16, 2008 · 11 comments
Closed

simple match() implementation #168

p6rt opened this issue Jul 16, 2008 · 11 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 16, 2008

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

Searchable as RT56970$

@p6rt
Copy link
Author

p6rt commented Jul 16, 2008

From @cjfields

Attached is a (very simple) patch for a match() implementation (method
version of m//). This version doesn't take modifiers yet; not sure if
we should wait until PGE LTM fixes are in.

chris

@p6rt
Copy link
Author

p6rt commented Jul 16, 2008

From @cjfields

match.diff

@p6rt
Copy link
Author

p6rt commented Jul 17, 2008

From @cjfields

On Tue Jul 15 19​:48​:05 2008, cjfields wrote​:

Attached is a (very simple) patch for a match() implementation (method
version of m//). This version doesn't take modifiers yet; not sure if
we should wait until PGE LTM fixes are in.

chris

Latest patch modifies ACCEPT to use .match (per pmichaud on p6-compiler). Passes
spectest_regression.

@p6rt
Copy link
Author

p6rt commented Jul 17, 2008

From @cjfields

match.diff
Index: CREDITS
===================================================================
--- CREDITS	(revision 29534)
+++ CREDITS	(working copy)
@@ -157,6 +157,9 @@
 D: TAP language author, and Parrot Bug fixes
 E: cdolan@cpan.org
 
+N: Chris Fields (cjfields)
+D: Rakudo patches
+
 N: Christoph Otto a.k.a. cotto
 D: Patch for key flags in pdd08
 D: Range check in Env PMC
Index: languages/perl6/src/builtins/any-str.pir
===================================================================
--- languages/perl6/src/builtins/any-str.pir	(revision 29534)
+++ languages/perl6/src/builtins/any-str.pir	(working copy)
@@ -75,6 +75,17 @@
     .return ($P0)
 .end
 
+=item match()
+
+=cut
+
+.sub 'match' :method
+    .param pmc x
+    .local pmc match
+    match = x(self)
+    .return (match)
+.end
+
 =item trans()
 
   Implementation of transliteration
Index: languages/perl6/src/classes/Code.pir
===================================================================
--- languages/perl6/src/classes/Code.pir	(revision 29534)
+++ languages/perl6/src/classes/Code.pir	(working copy)
@@ -30,7 +30,7 @@
 .sub 'ACCEPTS' :method
     .param pmc topic
     .local pmc match
-    match = self(topic)
+    match = topic.'match'(self)
     $P0 = getinterp
     $P1 = $P0['lexpad';1]
     $P1['$/'] = match

@p6rt
Copy link
Author

p6rt commented Jul 17, 2008

@cjfields - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 24, 2008

From @moritz

On Wed Jul 16 19​:36​:05 2008, cjfields wrote​:

On Tue Jul 15 19​:48​:05 2008, cjfields wrote​:

Attached is a (very simple) patch for a match() implementation
(method
version of m//). This version doesn't take modifiers yet; not sure
if
we should wait until PGE LTM fixes are in.

chris

Latest patch modifies ACCEPT to use .match (per pmichaud on p6-
compiler). Passes
spectest_regression.

This version of Str.match returns another Str object, when in fact it
should return a Match object. It would be nice if you could update your
patch to do that.

The corresponding test file is t/spec/S05-substitution/match.t

@p6rt
Copy link
Author

p6rt commented Aug 24, 2008

From @cjfields

On Sun Aug 24 03​:05​:55 2008, moritz wrote​:

On Wed Jul 16 19​:36​:05 2008, cjfields wrote​:

On Tue Jul 15 19​:48​:05 2008, cjfields wrote​:

Attached is a (very simple) patch for a match() implementation
(method
version of m//). This version doesn't take modifiers yet; not sure
if
we should wait until PGE LTM fixes are in.

chris

Latest patch modifies ACCEPT to use .match (per pmichaud on p6-
compiler). Passes
spectest_regression.

This version of Str.match returns another Str object, when in fact it
should return a Match object. It would be nice if you could update your
patch to do that.

The corresponding test file is t/spec/S05-substitution/match.t

This patch is blocking on RT #​57094 (which explains why a Str is returned).

@p6rt
Copy link
Author

p6rt commented Sep 8, 2008

From @cjfields

Updated patch (against r30888).

@p6rt
Copy link
Author

p6rt commented Sep 8, 2008

From @cjfields

match.diff
Index: CREDITS
===================================================================
--- CREDITS	(revision 30888)
+++ CREDITS	(working copy)
@@ -162,6 +162,9 @@
 D: TAP language author, and Parrot Bug fixes
 E: cdolan@cpan.org
 
+N: Chris Fields (cjfields)
+D: Rakudo patches
+
 N: Christoph Otto a.k.a. cotto
 D: Patch for key flags in pdd08
 D: Range check in Env PMC
Index: languages/perl6/src/builtins/any-str.pir
===================================================================
--- languages/perl6/src/builtins/any-str.pir	(revision 30888)
+++ languages/perl6/src/builtins/any-str.pir	(working copy)
@@ -75,6 +75,17 @@
     .return ($P0)
 .end
 
+=item match()
+
+=cut
+
+.sub 'match' :method :multi(_)
+    .param pmc x
+    .local pmc match
+    match = x(self)
+    .return(match)
+.end
+
 =item rindex()
 
 =cut
@@ -140,7 +151,6 @@
     .return ($S1)
 .end
 
-
 =item trans()
 
   Implementation of transliteration
Index: languages/perl6/src/classes/Code.pir
===================================================================
--- languages/perl6/src/classes/Code.pir	(revision 30888)
+++ languages/perl6/src/classes/Code.pir	(working copy)
@@ -30,7 +30,7 @@
 .sub 'ACCEPTS' :method
     .param pmc topic
     .local pmc match
-    match = self(topic)
+    match = topic.'match'(self)
     $P0 = getinterp
     $P1 = $P0['lexpad';1]
     $P1['$/'] = match

@p6rt
Copy link
Author

p6rt commented Sep 16, 2008

From @moritz

On Mon Sep 08 07​:13​:28 2008, cjfields wrote​:

Updated patch (against r30888).

Applied as r31185, thanks.

(If I show interest in applying patches and then forget them, please
feel free to prod me again. That's what happened here)

@p6rt
Copy link
Author

p6rt commented Sep 16, 2008

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

@p6rt p6rt closed this as completed Sep 16, 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