Need help with Rewrite Rule

94 views
Skip to first unread message

jtu...@objektfabrik.de

unread,
Mar 30, 2012, 9:30:55 AM3/30/12
to va-sma...@googlegroups.com
Hi there,

I´m stuck in a problem with a seemingly simple rewrite rule. For some reason I want to rename a lot of methods without replacing the existing and also not replacing the senders. In a second step I want to rewrite the exisitin methods.

So what I try to do is to find methods using this find rule:

oldMethod
  | `@Temps |
  ``@.Statements.

and copy them using this replace rule:

newMethod
| `@Temps | ``@.Statements.

Using the find button I see all implementors of oldMethod, but pressing Replace (together with checking "All Method") in the rewrite editor brings up the following error:

newMethod
| MetaVar not in search text ->`@Temps | ``@.Statements.

But as you can see the meta var `@Temps is in the search text. So what is my problem?

Thank you in advance

Sebastian Heidbrink

unread,
Mar 30, 2012, 11:21:22 AM3/30/12
to va-sma...@googlegroups.com
Hi Joachim,

I had those messages while just trying out the examples.
In my case it was jsut a typo! Try to use ' instead of `  this helped in my case.

Sebastian
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/uzg7qa5SzIEJ.
To post to this group, send email to va-sma...@googlegroups.com.
To unsubscribe from this group, send email to va-smalltalk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.

jtu...@objektfabrik.de

unread,
Mar 31, 2012, 1:21:34 AM3/31/12
to va-sma...@googlegroups.com


Sebastian,

unfortunately it's not that easy:

oldMethod
  | '@Temps |
  ''@.StatementsUnmatched ' in string literal. ->.

this time it's the search pattern in which I get the error.
So do I have to multiply the ' in order to make them match, or is it only one of the two uses of ` (meta var and recursion) that I have to replace?


Joachim



Am Freitag, 30. März 2012 17:21:22 UTC+2 schrieb Sebastian Heidbrink:
Hi Joachim,

I had those messages while just trying out the examples.
In my case it was jsut a typo! Try to use ' instead of `  this helped in my case.

Sebastian


Richard Sargent

unread,
Apr 1, 2012, 9:59:33 AM4/1/12
to va-sma...@googlegroups.com
This looks like a defect has been introduced.

In VisualAge 6.0.2, the Rewrite Tool works as you would expect:
Find:
asString

    | ``@temps |
    ``@.statements

Replacement:
asStringReplacement

    | ``@temps |
    ``@.statements

Works as you would expect. Under VASmalltalk 8.0, you get the "MetaVar not in search text  ->" error when you click Replace..

jtu...@objektfabrik.de

unread,
Apr 2, 2012, 3:39:57 AM4/2/12
to va-sma...@googlegroups.com
Rick,

thanks for comparing with 6.0.2. I had a similar idea: I just tried in Pharo and also came to the conclusion that this must be some bug or incompatibility in VAST.

So let's hope someone at Instantiations takes some time to look into this. 
The Rewrite tool is a cool way of proving how superior Smalltalk can be in code maintenance. Refactoring is the first step, and Rewriting can be so much more powerful!

Joachim

jtu...@objektfabrik.de

unread,
Apr 2, 2012, 11:29:37 PM4/2/12
to va-sma...@googlegroups.com
Richard,

VisualAge 6.02 didn't ship with RB, so the version you're using must be imported from somewhere. Could you tell me where it's from and/or what exact version it is? 
I have contacted VAST support and they need the exact version to compare the results.

Thanks in advance

Joachim

Am Sonntag, 1. April 2012 15:59:33 UTC+2 schrieb Richard Sargent:

Adriaan van Os

unread,
Apr 3, 2012, 5:02:41 AM4/3/12
to va-sma...@googlegroups.com
Joachim,

Have a look at http://customrefactor.sourceforge.net/stable.htm for versions of RB for VASt (from the pre-http://vastgoodies.com days of the projects http://vastgoodies.com/projects/Custom%20Refactoring%20and%20Rewrite%20Editor%20Usability days).

Cheers,
Adriaan.

Richard Sargent

unread,
Apr 3, 2012, 6:49:32 AM4/3/12
to va-sma...@googlegroups.com
It is version R3.5.1 with a couple of minor changes that are definitely unrelated to the rewrite tool.
(One change is to remove the #-> method which became part of the CLDT application with VAST 6.0. The other change is to prevent refactorings on methods such as #abtBuildInternals.)

I could not upload it to the VAST Goodies site. However, I have attached it as a zip file.


At this point in time, I no longer have any idea from where I got the original R3.5.1 code.
      Richard
RB351plus.zip

jtu...@objektfabrik.de

unread,
Apr 3, 2012, 8:01:33 AM4/3/12
to va-sma...@googlegroups.com
Richard,

thanks a lot for your help. I hope this will help Instantiations hunt down the problem. 

Joachim

Sebastian Heidbrink

unread,
Apr 3, 2012, 9:23:24 AM4/3/12
to va-sma...@googlegroups.com
Hi!

I think I got my version at that time from here:

http://sourceforge.net/projects/customrefactor/files/customrefactor/CS11%20Release%20Candidate%202/

As far as I can remember the Rewrite Tool was part of the Refactoring Browser and there once also was a download at Refactory Inc. 's homepage...

Sebastian
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/cLHypN824S0J.

Solveig

unread,
Apr 4, 2012, 2:57:01 PM4/4/12
to VA Smalltalk
this corresponds to Instantiations case 49471

On Mar 30, 9:30 am, "jtuc...@objektfabrik.de"
<jtuc...@objektfabrik.de> wrote:
> Hi there,
>
> I´m stuck in a problem with a seemingly simple rewrite rule. For some
> reason I want to rename a lot of methods without replacing the existing and
> also not replacing the senders. In a second step I want to rewrite the
> exisitin methods.
>
> So what I try to do is to find methods using this find rule:
>
> oldMethod
>
>   | `@Temps |
>   ``@.Statements.
>
> and copy them using this replace rule:
>
> newMethod
>   | `@Temps |
>   ``@.Statements.
>
> Using the find button I see all implementors of oldMethod, but pressing
> Replace (together with checking "All Method") in the rewrite editor brings
> up the following error:
>
> newMethod
>   | *MetaVar not in search text  ->*`@Temps |
Reply all
Reply to author
Forward
0 new messages