jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: bskip_chars("...\\") -> Unfinished escape sequence


> -----Original Message-----
> From: John E. Davis [mailto:davis@xxxxxxxxxxxxx] 
> Sent: lunedì 21 febbraio 2005 0.59
> Subject: Re: bskip_chars("...\\") -> Unfinished escape sequence
> 
> Joerg Sommer <joerg@xxxxxxxxxxxx> wrote:
> >I don't know what's going on here, but I get an error, where I never 
> >got it before.
> >
> >bskip_chars("A-Z\\") should skip all big letter characters and 
> >backslash, but I get SLang_verror (SL_INVALID_PARM, 
> "Unfinished escape 
> >sequence in range specification"); from slwclut.c:396 in SLang-2.
> 
>    This is something that will need to be documented.  The 
> problem is that with UTF-8 support "all big letter 

[SNIP]

By the way, while writing a slang script to hack a text file to xml, I see
that the documentation for 'string_match()' says:

---- quote on
 NOTES
   Positions in the string are specified using byte-offsets not
   character offsets.
---- quote off

And for string_match_nth():

---- quote on
 DESCRIPTION
   The `string_match_nth' function returns two integers describing
   the result of the last call to `string_match'.  It returns both
   the zero-based byte-position of the `nth' submatch and
   the length of the match.
---- quote off

The most common usage is using the return values of string_match_nth() as
array indexes on a string, like:

define match_func(s, regexp)
{
	variable pos, len;

	if (string_match(s, regexp, 1) < 0)
		error("string does not match!");
	
	(pos, len) = string_match_nth(1);
	return s[[pos:pos+len-1]];
}

But reading the latest slang documentation, I can't find a reference to what
type s[x] has (if 's' is of String_Type). If it is byte-indexed, s[[4:10]]
may be a invalid utf-8 string, but if it is char-indexed, you can't use the
values from string_match_nth() to index a string.

I'm sure John can explain how things should work.

Thanks,
						Dino

-- 
variable k,z,c=-2.0-1.5i;loop(24){loop(80){z=0i;for(k=96;(k>32)and(abs(z
)<4);k--)z=z*z+c;()=printf(char(k));c+=.0375;}c=-2.0+(Imag(c)+.125)*1i;}


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]