all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7322: 23.1; tqs-escape-syntax-error
@ 2010-11-03 11:47 Andreas Röhler
  2010-11-08 18:57 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Röhler @ 2010-11-03 11:47 UTC (permalink / raw)
  To: 7322

Hi,

editing python code, the following code concatenates strings with variables:

"""(beginning-of-form-base \"""" + string1 + """\" \"""" + string2 + 
"""\" nil nil nil nil t))))"""

while " + string1 +" is highlighted correctly, " + string2 + " has 
string face wrongly.

Also `ppss' falsely indicates being inside a string.

BTW everything is fine with an alternative coding using
singlequotes:

"""(beginning-of-form-base \"""" + string1 + '\" \"' + string2 + """\" 
nil nil nil nil t))))"""

The bug however exists.

Thanks all


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/



In GNU Emacs 23.1.1 (i586-suse-linux-gnu, GTK+ Version 2.20.1)
  of 2010-07-05
Windowing system distributor `The X.Org Foundation', version 11.0.10800000
configured using `configure  '--with-pop' '--without-hesiod' 
'--with-kerberos' '--with-kerberos5' '--with-xim' '--prefix=/usr' 
'--mandir=/usr/share/man' '--infodir=/usr/share/info' 
'--datadir=/usr/share' '--localstatedir=/var' 
'--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--with-x' 
'--with-sound' '--with-sync-input' '--with-xpm' '--with-jpeg' 
'--with-tiff' '--with-gif' '--with-png' '--with-rsvg' '--with-dbus' 
'--without-gpm' '--with-x-toolkit=gtk' '--x-includes=/usr/include' 
'--x-libraries=/usr/lib:/usr/share/X11' '--with-xft' '--with-libotf' 
'--with-m17n-flt' '--build=i586-suse-linux' 
'build_alias=i586-suse-linux' 'CC=gcc-4.3' 'CFLAGS=-fomit-frame-pointer 
-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector 
-funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -std=gnu89 
-pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label 
-Wno-unprototyped-calls -fno-optimize-sibling-calls 
-DSYSTEM_PURESIZE_EXTRA=55000 	 -DSITELOAD_PURESIZE_EXTRA=10000 ' 
'LDFLAGS=-Wl,-O2 -Wl,--hash-size=65521''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: de_DE.UTF-8
   value of $XMODIFIERS: @im=local
   locale-coding-system: utf-8-unix
   default-enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
   tooltip-mode: t
   tool-bar-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   global-auto-composition-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <up> <up> <up> <up>
<up> <up> <up> <left> <left> <left> C-j <up> ; ; SPC
<down> <left> C-x C-e C-x C-f p r o g a r <tab> p o
y <tab> <backspace> <backspace> y t <tab> t h <tab>
l i s t <tab> a <tab> <return> <next> <next> <next>
<next> <next> <next> <next> <next> <next> <next> <next>
<next> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <left> <up>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <help-echo>
C-h f p y t h o n m <backspace> - m o d e <return>
C-x 1 M-x r e p o r t - e m a c s - b u <tab> <ret
urn>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark saved where search started
Mark set






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#7322: 23.1; tqs-escape-syntax-error
  2010-11-03 11:47 bug#7322: 23.1; tqs-escape-syntax-error Andreas Röhler
@ 2010-11-08 18:57 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2010-11-08 18:57 UTC (permalink / raw)
  To: Andreas Röhler

>>>>> "Andreas" == Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> Hi,

> editing python code, the following code concatenates strings with variables:

> """(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


=== 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]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix.
+              "\\(?:\\('\\)'\\('\\)\\|\\(?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 (= n 2)			; leading quote (not prefix)
-	       (= (match-beginning 1) (match-end 1))) ; prefix is null
+	       (not (match-end 1)))     ; prefix is null
 	  (and (= n 1)			; prefix
-	       (/= (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 "|")))))






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-08 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-03 11:47 bug#7322: 23.1; tqs-escape-syntax-error Andreas Röhler
2010-11-08 18:57 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.