GNU bug report logs - #40231
sql.el: patch for syntax table propertizing escaped apostrophes in SQL strings as punctuation syntax class

Previous Next

Package: emacs;

Reported by: "Florian v. Savigny" <f.savigny <at> mailbox.org>

Date: Wed, 25 Mar 2020 21:44:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Florian v. Savigny" <f.savigny <at> mailbox.org>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Cc: Michael Mauger <michael <at> mauger.com>
Subject: sql.el: patch for syntax table propertizing escaped apostrophes in
 SQL strings as punctuation syntax class
Date: Wed, 25 Mar 2020 22:42:58 +0100 (CET)
[Message part 1 (text/plain, inline)]
Dear Emacs folks, dear Michael,

sql.el parses SQL strings containing escaped (double) apostrophes as separate strings (e.g. jumping right between the two apostrophes with forward-sexp) because it uses only parsing by syntax table, which cannot handle this construct.

This should be an adequate description of the limitation/bug, but more details are available at: 

   https://emacs.stackexchange.com/questions/56352/can-syntax-parsing-recognize-the-sql-escape-apostrophe-single-quote-constru

The attached is a diff against sql.el version 3.6 as shipped with Emacs 26.3. that implements propertizing such double apostrophes within strings with a punctuation syntax table property. (I have posted the code with exhaustive comments, which I thought excessive for working code, at the above URL.) My tests were movement commands across sexps, which crossed the whole string, and the return value of 

  (syntax-ppss (point))

which returned a list such as 

  (1 129 139 39 nil nil 0 nil 154 (129) nil)

when between two such apostrophes, just like when elsewhere in a string. I have done no further testing.

I do hope this meets the standards for a patch, as I've never submitted one before.

Best regards to everybody, and stay well!

Florian


Florian v. Savigny 
Siebenpfeiffer Str. 25 
66482 Zweibrücken 
Germany

0175 - 365 24 17
[sql.el-syntax-parsing-escaped-apostrophes.diff (text/x-patch, attachment)]

This bug report was last modified 5 years and 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.