From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jrwats Newsgroups: gmane.emacs.help Subject: Re: 2 styles of string literals, using cc-mode Date: Fri, 12 Dec 2008 22:01:32 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <1723d5b8-6bee-4ff0-9128-525da8a7b83c@i20g2000prf.googlegroups.com> 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 1229150505 26388 80.91.229.12 (13 Dec 2008 06:41:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Dec 2008 06:41:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 13 07:42:49 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LBODA-00013N-DU for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Dec 2008 07:42:48 +0100 Original-Received: from localhost ([127.0.0.1]:52201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LBOBy-0007VY-QF for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Dec 2008 01:41:34 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.stanford.edu!postnews.google.com!n33g2000pri.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-NNTP-Posting-Host: 67.183.31.62 Original-X-Trace: posting.google.com 1229148092 17545 127.0.0.1 (13 Dec 2008 06:01:32 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 13 Dec 2008 06:01:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n33g2000pri.googlegroups.com; posting-host=67.183.31.62; posting-account=bFjqRgoAAAA1g2eFs8HouoaeO5EHoWR2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.4) Gecko/2008111319 Ubuntu/8.10 (intrepid) Firefox/3.0.4, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165252 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60577 Archived-At: On Oct 21, 9:54=A0am, yary wrote: > Hi all, > > I'm using csharp-mode by Moonfire games (http://mfgames.com/linux/csharp-= mode > ), which is derived from cc-mode. > > C# has a "feature", two styles of strings. Regular strings are very > much like C strings, starting and ending with double quotes, backslash > escapes allowed inside. > > @"Verbatim literal strings look like this"- they have an at-sign just > before the double-quote. Verbatim literal strings can have embedded > newlines, regular strings can't. Backslashes have no special meaning > inside verbatim literals, so: > > @"\x00" =3D=3D "\\x00" > @"foo\" =3D=3D "foo\\" > > I haven't hacked much cc-mode or elisp in general, still it was pretty > simple to get multiline verbatim literals working: > > ;; Can't escape a newline in a regular string > (c-lang-defconst c-string-escaped-newlines > =A0 csharp nil) > > ;; Literal strings can be multiline without escaping > (c-lang-defconst c-multiline-string-start-char > =A0 csharp ?@) > > I had expected the @ to fontify the same as the " in @" after adding > the following, but these seem to have made no difference: > > ;; Start of a comment or any string literal- copied from cc-lang, > added @? before \" > (c-lang-defconst c-literal-start-regexp > =A0 csharp (concat (c-lang-const c-comment-start-regexp) > =A0 =A0 =A0 =A0 =A0 =A0 "\\|" > =A0 =A0 =A0 =A0 =A0 =A0 (if (memq 'gen-string-delim c-emacs-features) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "@?\"|" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 "@?\""))) > > ;; add verbatim string literal to primary regexp > (c-lang-defconst c-primary-expr-regexp > =A0 csharp (concat (c-lang-const c-primary-expr-regexp) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"\\|@\"")) > > ... and I have no clue how to tell emacs to change the syntax of \ > inside a verbatim literal in csharp mode, so it won't be an escape > anymore. I took a look at cc-engine.el to get a clue as to how it > works, but its elisp is too advanced for me. Any pointers? ping. I need this too! Has anyone figured this out yet? I suppose I could start investigating some emacs-lisp source code...