From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7322: 23.1; tqs-escape-syntax-error Date: Mon, 08 Nov 2010 13:57:34 -0500 Message-ID: References: <4CD14BC0.80709@easy-emacs.de> 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: dough.gmane.org 1289243646 20136 80.91.229.12 (8 Nov 2010 19:14:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 8 Nov 2010 19:14:06 +0000 (UTC) To: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 08 20:14:02 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PFXAC-0004jE-8u for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Nov 2010 20:14:02 +0100 Original-Received: from localhost ([127.0.0.1]:49794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFXA6-0000TA-9r for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Nov 2010 14:13:50 -0500 Original-Received: from [140.186.70.92] (port=53162 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFXA1-0000Sj-CZ for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 14:13:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFXA0-0003Ja-1Y for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 14:13:45 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFX9z-0003JV-V7 for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 14:13:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PFWss-0007QL-I9 for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 13:56:02 -0500 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Nov 2010 18:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 7322 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 7322@debbugs.gnu.org, monnier@iro.umontreal.ca Original-Received: via spool by 7322-done@debbugs.gnu.org id=D7322.128924255628530 (code D ref 7322); Mon, 08 Nov 2010 18:56:02 +0000 Original-Received: (at 7322-done) by debbugs.gnu.org; 8 Nov 2010 18:55:56 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PFWsm-0007Q7-6C for submit@debbugs.gnu.org; Mon, 08 Nov 2010 13:55:56 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PFWps-0007OV-4v for 7322-done@debbugs.gnu.org; Mon, 08 Nov 2010 13:52:56 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtEKAEPX10xMCpqE/2dsb2JhbAChCIEDcr1EhUgEhFiNWg X-IronPort-AV: E=Sophos;i="4.59,169,1288584000"; d="scan'208";a="81948544" Original-Received: from 76-10-154-132.dsl.teksavvy.com (HELO pastel.home) ([76.10.154.132]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 08 Nov 2010 13:57:34 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 55F95A86D8; Mon, 8 Nov 2010 13:57:34 -0500 (EST) In-Reply-To: <4CD14BC0.80709@easy-emacs.de> ("Andreas =?UTF-8?Q?R=C3=B6hler?="'s message of "Wed, 03 Nov 2010 12:47:12 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Mailman-Approved-At: Mon, 08 Nov 2010 13:55:50 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 08 Nov 2010 13:56:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41439 Archived-At: >>>>> "Andreas" =3D=3D Andreas R=F6hler wri= tes: > Hi, > editing python code, the following code concatenates strings with variabl= es: > """(beginning-of-form-base \"""" + string1 + """\" \"""" + string2 + """\" > nil nil nil nil t))))""" > while " + string1 +" is highlighted correctly, " + string2 + " has string > face wrongly. Thanks. Indeed backslashes weren't recognized properly in this case. I've installed the patch below in the emacs-23 branch, which seems to fix this problem. Stefan =3D=3D=3D modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2010-08-23 00:44:55 +0000 +++ lisp/progmodes/python.el 2010-11-08 18:53:30 +0000 @@ -170,18 +170,9 @@ ;; Make outer chars of matching triple-quote sequences into generic ;; string delimiters. Fixme: Is there a better way? ;; First avoid a sequence preceded by an odd number of backslashes. - `((,(rx (not (any ?\\)) - ?\\ (* (and ?\\ ?\\)) - (group (syntax string-quote)) - (backref 1) - (group (backref 1))) - (2 ,(string-to-syntax "\""))) ; dummy - (,(rx (group (optional (any "uUrR"))) ; prefix gets syntax property - (optional (any "rR")) ; possible second prefix - (group (syntax string-quote)) ; maybe gets property - (backref 2) ; per first quote - (group (backref 2))) ; maybe gets property - (1 (python-quote-syntax 1)) + `((,(concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefi= x. + "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)") + (1 (python-quote-syntax 1) nil lax) (2 (python-quote-syntax 2)) (3 (python-quote-syntax 3))) ;; This doesn't really help. @@ -219,9 +210,9 @@ (eval-when-compile (string-to-syntax "|")))))) ;; Consider property for initial char, accounting for prefixes. ((or (and (=3D n 2) ; leading quote (not prefix) - (=3D (match-beginning 1) (match-end 1))) ; prefix is null + (not (match-end 1))) ; prefix is null (and (=3D n 1) ; prefix - (/=3D (match-beginning 1) (match-end 1)))) ; non-empty + (match-end 1))) ; non-empty (let ((font-lock-syntactic-keywords nil)) (unless (eq 'string (syntax-ppss-context (syntax-ppss))) (eval-when-compile (string-to-syntax "|")))))