Regex

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Regex

Mike Hales
Does anybody have a regex that will match a Smalltalk block.  I'm no regex pro and I'm struggling to get one that works.

Thanks,

Mike

Mike Hales
Engineering Manager
KnowledgeScape
(801)413-2809
(801)880-6270 Fax



Reply | Threaded
Open this post in threaded view
|

Re: Regex

Vassili Bykov
You can make a regex that will match an open bracket followed by stuff
followed by a close bracket, but a real solution would have to properly
handle nesting of blocks, and that is theoretically impossible with
regexes as it would require infinite state. (The reason C comments end
with a first */ and can't nest).

Mike Hales wrote:

> Does anybody have a regex that will match a Smalltalk block.  I'm no
> regex pro and I'm struggling to get one that works.
>
> Thanks,
>
> Mike
>
> Mike Hales
> Engineering Manager
> KnowledgeScape
> (801)413-2809
> (801)880-6270 Fax
> [hidden email] <mailto:[hidden email]>
>
>
>


--
Vassili Bykov <[hidden email]>

[:s | s, s printString] value: '[s: | s, s printString] value: '

Reply | Threaded
Open this post in threaded view
|

Re: Regex

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Mike Hales
Re: Regex

You didn't mention what exactly you are trying to do, but is there any chance you could use a rewrite tool?

Cheers!

-Boris


----- Original Message -----
From: Mike Hales <[hidden email]>
To: VW NC <[hidden email]>
Sent: Sun Nov 12 07:43:06 2006
Subject: Regex

Does anybody have a regex that will match a Smalltalk block.  I'm no regex pro and I'm struggling to get one that works.

Thanks,

Mike

Mike Hales
Engineering Manager
KnowledgeScape
(801)413-2809
(801)880-6270 Fax
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: Regex

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Mike Hales
Re: Regex

More specifically,

[:`@vars | ``@anything]

Cheers!

-Boris
(Sent from a BlackBerry)

----- Original Message -----
From: Boris Popov <[hidden email]>
To: [hidden email] <[hidden email]>; [hidden email] <[hidden email]>
Sent: Sun Nov 12 18:09:40 2006
Subject: Re: Regex

You didn't mention what exactly you are trying to do, but is there any chance you could use a rewrite tool?

Cheers!

-Boris


----- Original Message -----
From: Mike Hales <[hidden email]>
To: VW NC <[hidden email]>
Sent: Sun Nov 12 07:43:06 2006
Subject: Regex

Does anybody have a regex that will match a Smalltalk block.  I'm no regex pro and I'm struggling to get one that works.

Thanks,

Mike

Mike Hales
Engineering Manager
KnowledgeScape
(801)413-2809
(801)880-6270 Fax
[hidden email]





Reply | Threaded
Open this post in threaded view
|

Re: Regex

Mike Hales
In reply to this post by Vassili Bykov

> You can make a regex that will match an open bracket followed by  
> stuff followed by a close bracket, but a real solution would have  
> to properly handle nesting of blocks, and that is theoretically  
> impossible with regexes as it would require infinite state. (The  
> reason C comments end with a first */ and can't nest).
>
That's the conclusion I finally drew also.  I have re-written our  
expert system rule language using SmaCC instead of ATParserCompiler  
and one thing that I did was to allow "super users" to embed  
Smalltalk blocks within our language.  Looking for square brackets  
works as long as you only embed one block in a single rule.  I  
settled for the C comments style approach and just use a token to  
mark the start and end of Smalltalk code.

Mike