emacs-devel
[Top][All Lists]
Advanced

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

Re: parse-partial-sexp parses only Lisp?


From: Lennart Borgman (gmail)
Subject: Re: parse-partial-sexp parses only Lisp?
Date: Wed, 02 Apr 2008 19:58:18 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

martin rudalics wrote:
>  > - What variables are used when searching for comments?
>
> I don't understand: `parse-partial-sexp' uses the syntax-table to
> identify start and end sequences of comments and strings.  Sometimes
> syntax-table text-properties are used.  What kind of "variables" do you
> have in mind?

syntax-table? Is that the syntax table returned by (syntax-table) and set by (set-syntax-table TABLE)? The doc string does not mention this.

I thought that perhaps the comment delimiters where involved. The syntax tables as above seems to be able to take care of C style comments (max 2 chars in delimeters), but it can not handle html comments AFAICS.

I guess then parse-partial-sexp can not return info about html comments, right? Can syntax-pps do that? (The doc string for syntax-ppss says the return values are the same as for parse-partial-sexp.)

>  > - What do I have to put in OLDSTATE to make it parse comments and
>  > strings correctly? - assuming that I know about previous comments and
>  > strings and if FROM is inside a comment or string.
>
> You know about previous comments and strings iff you are neither in a
> comment nor in a string.  Strings and comments can be nested in so many
> forms that it's strongly encouraged to either use the state returned by
> a previous call of `parse-partial-sexp' or assure that you start outside
> of any comments or strings.  `syntax-begin-function' if provided is a
> good choice here.

Thanks.





reply via email to

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