help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python, syntax-ppss


From: Andreas Röhler
Subject: Re: Python, syntax-ppss
Date: Mon, 6 Feb 2023 14:43:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1


Am 06.02.23 um 12:53 schrieb Arash Esbati:
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

when calling (syntax-ppss) at the end of the Python snippet below, it yields

(1 6 7 34 nil nil 0 nil 8 (6) nil)

whereas nth 1 --depth in parens--, should tell "2", as the opening
curly bracket should count too:

---
print(f"Addition: {m1 + m2
---
The 34 says that the point is inside a string, more precisely, this is
the character that will terminate the string[1] -- in this case " which
has the codepoint 34.  The parser doesn't count the depth in parens
inside strings.  Emacs sees only one open parentheses, and that in
buffer position 6.

Best, Arash

Footnotes:
[1]  https://www.gnu.org/software/emacs/manual/html_node/elisp/Parser-State.html


Thanks. So I have to provide some extra checks for this case.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]