[Ironruby-core] Match operator

Cory Foy Cory.Foy at microsoft.com
Mon Oct 15 12:25:26 EDT 2007


Hi Tomas,

I took a stab at seeing if I could get something working with that. But I couldn't seem to get things to get recognized.

The steps I took were:

Add a new MatchExpression class which derives from Expression in Ruby\Compiler\AST\Expressions. Define a constructor which takes three parameters, and have it call the base constructor passing in location. Override TransformRead in my MatchExpression class.

I then modified Parser.y to uncomment out the line listed below. I tried a pass and it didn't call it, so I tried running the ClassInitGenerator, but it didn't seem to change anything.

On a whim, I modified Parser.Generated.cs where that line from Parser.y was, and had it call yyval.Expression = new MatchExpresssion. This worked (i.e.it called my method), but then I got that the method wasn't implemented.

So I tried adding a method to MutableStringOps for Match, but it didn't seem to find it.

I'm really trying to understand how one goes from end-to-end here, so can anyone offer some insights?

Cory


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek
Sent: Monday, October 15, 2007 12:02 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Match operator

We don't support regular expressions yet. Coming soon. Please, be patient.

Tomas

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Curt Hagenlocher
Sent: Sunday, October 14, 2007 4:29 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Match operator

On 10/14/07, Sanghyeon Seo <sanxiyn at gmail.com<mailto:sanxiyn at gmail.com>> wrote:
2007/10/15, Curt Hagenlocher <curt at hagenlocher.org<mailto:curt at hagenlocher.org>>:
> I don't see any evidence in
> src\IronRuby\Compiler\Parser\Parser.y that these symbol
> combinations are recognized as distinct tokens.

But the stacktrace shows Ruby.Compiler.Parser.Parse, so I assumed it's
crashing while parsing. Am I wrong?

Hmm.. I had assumed that the parser was recognizing this as <value><equals><binary negation><value>.  I was wrong, and these symbols are actually defined as MATCH and NMATCH in the grammar.  Their implementation, however, is commented out:

| arg MATCH arg
{
//$$ = new MatchExpression($1, $3, @$);
}
| arg NMATCH arg
{
//$$ = new NotExpression(new MatchExpression($1, $3, @$), @$);
}
There does not actually appear to be any implementation of the MatchExpression class.

--
Curt Hagenlocher
curt at hagenlocher.org<mailto:curt at hagenlocher.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20071015/cb025d51/attachment-0001.html 


More information about the Ironruby-core mailing list