emacs-devel
[Top][All Lists]
Advanced

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

Re: Writing syntax-propertize-function for strings in code in strings, e


From: Dmitry Gutov
Subject: Re: Writing syntax-propertize-function for strings in code in strings, etc
Date: Sat, 27 Oct 2012 01:52:06 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 27.10.2012 0:41, Stefan Monnier wrote:
Yes, one "push <inner-syntax-table>" and one "pop".
So, I don't see the usefulness of the <inner-syntax-table> value in the
simple case of embedding code in the same language.

It's for the other cases: strings with strings and comments within strings.

Okay. I guess I just don't know [well enough] any languages with different embedded syntaxes.

Unless we're doing something like the "multiple-modes" use case, which we
discussed in another thread.

Yes, it potentially could be used for m-m-m, tho it would only be
a piece of the puzzle (and it's not clear how useful that piece would be
in the end, once we have the whole puzzle).

It will help with third-party frameworks, at least, which is what we discussed back then, that (syntax-ppss) will return reasonable values.

Of course, this is fine for parse-partial-sexp, but it's a different
matter for backward-sexp, where the "pop" would also need to know the
<inner-syntax-table>.
Maybe in the latter case the scanning function, when encountering the "pop"
syntax property, would just skip ahead until it finds the corresponding
"push"?

Without knowing the inner syntax table, it's pretty difficult to know
what can be skipped (unless we assume that the "push" can only be marked
with a `syntax-table' text-property).

Indeed. But I think it's a reasonable assumption. In all cases I can think about the "region opener" is at least two characters long, and it often depends on the context (like only inside a string).

But suppose "push" characters can be set inside a syntax table.
Let's move point inside an embedded code region, maybe several levels deep. Now we want to call `forward-sexp'. How will it know the effective syntax-table value at that position?



reply via email to

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