From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dino chiesa Newsgroups: gmane.emacs.devel Subject: cc-mode help - how to support literal strings in C# syntax? Date: Mon, 28 Dec 2009 17:51:52 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1262051534 17993 80.91.229.12 (29 Dec 2009 01:52:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Dec 2009 01:52:14 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 29 02:52:07 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NPRFj-0001xj-VW for ged-emacs-devel@m.gmane.org; Tue, 29 Dec 2009 02:52:04 +0100 Original-Received: from localhost ([127.0.0.1]:51667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPRFk-0006QH-G1 for ged-emacs-devel@m.gmane.org; Mon, 28 Dec 2009 20:52:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NPRFe-0006Oj-Il for emacs-devel@gnu.org; Mon, 28 Dec 2009 20:51:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NPRFZ-0006LS-Oj for emacs-devel@gnu.org; Mon, 28 Dec 2009 20:51:58 -0500 Original-Received: from [199.232.76.173] (port=49636 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NPRFZ-0006LL-MH for emacs-devel@gnu.org; Mon, 28 Dec 2009 20:51:53 -0500 Original-Received: from col0-omc4-s10.col0.hotmail.com ([65.55.34.212]:17428) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NPRFZ-0001XK-8t for emacs-devel@gnu.org; Mon, 28 Dec 2009 20:51:53 -0500 Original-Received: from COL124-W33 ([65.55.34.201]) by col0-omc4-s10.col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 28 Dec 2009 17:51:52 -0800 X-Originating-IP: [96.236.193.50] Importance: Normal X-OriginalArrivalTime: 29 Dec 2009 01:51:52.0355 (UTC) FILETIME=[7E10D730:01CA8829] X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118902 Archived-At: =20 I'm improving the csharp-mode from http://www.emacswiki.org/emacs/CSharpMod= e . In case you're not aware=2C it's derived from cc-mode=2C something lik= e Java=2C but with a few different syntactic quirks.=20 =20 The existing csharp-mode.el is pretty good.=20 There were a couple things I fixed:=20 =20 - #if/else/endif was not being properly recognized=2C=20 was indenting and fontifying strangely =20 - a struct was not being treated as a class - indenting inside the block wa= s broken. =20 - class definitions that derived from other classes were not being parsed a= s a class. =20 =20 These are all minor things I was able to resolve by using c-lang-defconst o= n various constants: c-typeless-decl-kwds=2C c-other-block-decl-kwds=2C c-= cpp-message-directives=2C c-cpp-expr-directives=2C c-colon-type-list-kwds= =2C c-symbol-chars=2C c-block-prefix-disallowed-chars=2C and a few others. =20 There's one think I haven't been able to resolve. In C# syntax=2C strings = can be specified as they are in C - surrounded by quotes. There's also a s= pecial form of literal string that begins with @=2C n which all characters = in the string are to be treated as "escaped". In other words=20 =20 @"\usr\bin" =3D=3D "\\usr\\bin" =20 The problem happens when the literal string ends in a slash. Eg @"\usr\bin= \" The cc-mode syntax engine sees that as an unterminated string=2C the \"= is an escaped double-quote. On the other hand the C# compiler sees it as = a string of 9 chars.=20 =20 Because it isn't parsed correctly=2C the fontification and indenting is wro= ng after a @-prefixed string that ends in a slash.=20 =20 =20 How can I get the prefixed strings to be treated correctly? =20 =20 Defining a special c-in-literal seems not to be it. That function uses par= se-partial-sexp =2C which apparently determines if the point is within a st= ring or not. =20 =20 Modifying the syntax table to insert @ as a special prefix is also not it. = =20 =20 Any suggestions?=20 =20 dpchiesa@hotmail.com =20 _________________________________________________________________ Hotmail: Trusted email with powerful SPAM protection. http://clk.atdmt.com/GBL/go/177141665/direct/01/=