From xemacs-m  Tue May 20 16:07:03 1997
Received: from mail.cis.ohio-state.edu (mail.cis.ohio-state.edu [164.107.8.55])
	by xemacs.org (8.8.5/8.8.5) with SMTP id QAA14616
	for <xemacs-beta@xemacs.org>; Tue, 20 May 1997 16:07:03 -0500 (CDT)
Received: from calico.cis.ohio-state.edu (calico.cis.ohio-state.edu [164.107.142.11]) by mail.cis.ohio-state.edu (8.6.7/8.6.4) with ESMTP id RAA07916; Tue, 20 May 1997 17:06:47 -0400
Received: (ware@localhost) by calico.cis.ohio-state.edu (8.8.0/8.6.4) id RAA13669; Tue, 20 May 1997 17:06:46 -0400 (EDT)
To: bwarsaw@python.org
Cc: XEmacs Beta Test <xemacs-beta@xemacs.org>
Subject: Re: (modify-syntax-entry ?_ "w")
References: <199705181327.GAA09948@xemacs.eng.sun.com> 	<199705200353.XAA11941@anthem.CNRI.Reston.Va.US> 	<vwmvi4dkjom.fsf@calico.cis.ohio-state.edu> <199705202032.QAA14024@anthem.CNRI.Reston.Va.US>
From: Pete Ware <ware@cis.ohio-state.edu>
Date: 20 May 1997 17:06:44 -0400
In-Reply-To: "Barry A. Warsaw"'s message of Tue, 20 May 1997 16:32:37 -0400
Message-ID: <vwmu3jxkg4b.fsf@calico.cis.ohio-state.edu>
Lines: 49
X-Mailer: Gnus v5.4.51/XEmacs 20.2(beta5)

"Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US> writes:

> >>>>> "PW" == Pete Ware <ware@cis.ohio-state.edu> writes:
> 
>     PW> Oh, you mean an identifier isn't a word?
> 
> It can be.  But identifiers can also be composed of
> more_than_one_word_separated_by_underscores.  I don't care how you
> slice it, underscore is not word class.
But that is exactly what I mean -- to me an identifier is equivalent
to a word (and vice versa).  I'm perfectly willing to accept your view 
that an identifier can be made up of multiple words.  To me, an
identifier with underscores is still a single word.

> 
>     PW> P.P.S. it seems pretty safe as it can't appear anywhere else
>     PW> in the language (except as a char).
> 
> Sorry, I don't get this.

I meant if an '_' appears, it has to be in an identifier (at least for 
C/C++) (with exceptions for it being in a string, or as a character
constant or in a comment).

> 
> Here's the problem: let's say I have to recognize the keyword `class',
> but I want to be sure that I don't accidentally treat the identifier
> `class_characteristics' as a keyword.  If I use regexps, then you
> better hope I use something like "class[^_]" instead of "class\\W",
> 'cause the latter would break if you change the syntax of _.

Isn't that backward?  The following is how I have it set and it
doesn't match the keyword "class" agains class_characterstics:

	(modify-syntax-entry ?_ "w")
	nil
	(string-match "class\\W" "class_characteristics")
	nil

The following is how you have it set and it does match (incorrectly):

	(modify-syntax-entry ?_ "_")
	nil
	(string-match "class\\W" "class_characteristics")
	0

?

--pete

