ScintillaOrg / lexilla

A library of language lexers for use with Scintilla
https://www.scintilla.org/Lexilla.html
Other
163 stars 59 forks source link

raw formatted string is not handled in Python lexer #223

Closed zufuliu closed 4 months ago

zufuliu commented 5 months ago

rf and fr, etc. are listed at https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

stringprefix    ::=  "r" | "u" | "R" | "U" | "f" | "F"
                     | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF"
name = 'notepad'
print(rf'C:\Windows\{name}.exe')
print(fr'C:\Windows\{name}.exe')
nyamatongwe commented 5 months ago

This is the case for rf but fr works due to test ordering.

RawFormattedPython

zufuliu commented 5 months ago

Current Python lexer doesn't distinguish between raw and normal string/bytes.

I'm not working on this, cc @jpe.

nyamatongwe commented 5 months ago

A potential patch but it's large for the small problem its addressing.

RawFormatted.patch

jpe commented 5 months ago

It should be a small change; I'll try to look at this in the next few days.

jpe commented 5 months ago

I created a pull request with a commit to fix this: https://github.com/ScintillaOrg/lexilla/pull/227