[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python, syntax-ppss
From: |
Arash Esbati |
Subject: |
Re: Python, syntax-ppss |
Date: |
Mon, 06 Feb 2023 12:53:36 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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