Re: To Dave Cuny re PATTERN.E

new topic     » goto parent     » topic index » view thread      » older message » newer message

"Zaphod Beeblebrox" wrote:

> how do i get just the filename.ext from the include line?

try the pattern:

   "^include/s+(/w+./w+)"

or this, which reads everything up to the first whitespace:

   "^include/s([^  ]*])"

the following *should* work since it's a variant of the prior, but it
doesn't:

   "^include/s(/S*)"

I need to look into this.


> Regarding test 2, why do I get "pattern.e -- and the rest"
> when I've specified the caret in the pattern to force
> start_of_string match?

Ooops. The ^ generates a START rule, which performs the following test:

   return (targetAt = 1)

This is supposed to fail if the position isn't the start of the string.
Reasonable enough, right? Unfortunately, in line 775 where I chop up the
target string into substrings, I wrote:

   -- initialize the target string to parse
   targetAt = 1
   targetString = target[targetAt..length(target)]

As you can see, instead of incrementing targetAt, I shorten the target
string. D'oh! The corrected code should be:

   -- initialize the target string to parse
   targetAt = i
   targetString = target

This should take care of the problem. Thanks!

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu