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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Florian v. Savigny-4
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 (2K) Download Attachment