1. To Dave Cuny re PATTERN.E
Dear Dave,
Regarding test 1, how do i get just the filename.ext from the include line?
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?
<CODE>
include pattern.e
procedure patt_test( sequence thePattern, sequence theData )
integer i
i = pattern( thePattern, theData )
end procedure
--test 1
patt_test( "^include/s+(.*)", "include pattern.e -- and the rest" )
puts( 1, arg[ 1 ] & '\n' )
--test 2
patt_test( "^include/s+(.*)", "-- include pattern.e -- and the rest" )
puts( 1, arg[ 1 ] & '\n' )
</CODE>
Zaph.
2. Re: To Dave Cuny re PATTERN.E
"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
3. Re: To Dave Cuny re PATTERN.E
Thus spake "Cuny, David@DSS" on Thu, 23 Mar 2000:
> "^include/s+(/w+./w+)"
which worked file
> "^include/s([^ ]*])"
which didn't
>
> -- initialize the target string to parse
> targetAt = i
> targetString = target
>
>This should take care of the problem. Thanks!
Which it did very nicely thank you very much!
Zaph.