all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* parse-partial-sexp parses only Lisp?
@ 2008-04-01 22:23 Lennart Borgman (gmail)
  2008-04-02  8:46 ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-01 22:23 UTC (permalink / raw)
  To: Emacs Devel

The first line of the doc string says so.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-01 22:23 parse-partial-sexp parses only Lisp? Lennart Borgman (gmail)
@ 2008-04-02  8:46 ` martin rudalics
  2008-04-02 14:59   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2008-04-02  8:46 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

 > The first line of the doc string says so.

`parse-partial-sexp' only happens to work correctly in many other modes
hence I think that line is good.  However, the doc string should mention
the "9th element" of the parse state and the fact that element 8 is
significant in STATE.  Finally, the term "character address" should be
replaced by "character position".





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-02  8:46 ` martin rudalics
@ 2008-04-02 14:59   ` Lennart Borgman (gmail)
  2008-04-02 16:59     ` martin rudalics
  2008-04-02 17:38     ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-02 14:59 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

martin rudalics wrote:
>  > The first line of the doc string says so.
> 
> `parse-partial-sexp' only happens to work correctly in many other modes
> hence I think that line is good.  However, the doc string should mention
> the "9th element" of the parse state and the fact that element 8 is
> significant in STATE.  Finally, the term "character address" should be
> replaced by "character position".

Thanks Martin. Some more things that I would like to know (from the doc 
string in the future):

- What variables are used when searching for comments?
- 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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-02 14:59   ` Lennart Borgman (gmail)
@ 2008-04-02 16:59     ` martin rudalics
  2008-04-02 17:58       ` Lennart Borgman (gmail)
  2008-04-02 17:38     ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: martin rudalics @ 2008-04-02 16:59 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

 > - 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?

 > - 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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-02 14:59   ` Lennart Borgman (gmail)
  2008-04-02 16:59     ` martin rudalics
@ 2008-04-02 17:38     ` Stefan Monnier
  2008-04-02 17:59       ` Lennart Borgman (gmail)
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2008-04-02 17:38 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: martin rudalics, Emacs Devel

>> > The first line of the doc string says so.
>> 
>> `parse-partial-sexp' only happens to work correctly in many other modes
>> hence I think that line is good.  However, the doc string should mention
>> the "9th element" of the parse state and the fact that element 8 is
>> significant in STATE.  Finally, the term "character address" should be
>> replaced by "character position".

> Thanks Martin. Some more things that I would like to know (from the doc
> string in the future):

> - What variables are used when searching for comments?
> - 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.

The description of the output is also the description of OLDSTATE.


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-02 16:59     ` martin rudalics
@ 2008-04-02 17:58       ` Lennart Borgman (gmail)
  2008-04-05 20:42         ` David Hansen
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-02 17:58 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-02 17:38     ` Stefan Monnier
@ 2008-04-02 17:59       ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-02 17:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: martin rudalics, Emacs Devel

Stefan Monnier wrote:
>>>> The first line of the doc string says so.
>>> `parse-partial-sexp' only happens to work correctly in many other modes
>>> hence I think that line is good.  However, the doc string should mention
>>> the "9th element" of the parse state and the fact that element 8 is
>>> significant in STATE.  Finally, the term "character address" should be
>>> replaced by "character position".
> 
>> Thanks Martin. Some more things that I would like to know (from the doc
>> string in the future):
> 
>> - What variables are used when searching for comments?
>> - 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.
> 
> The description of the output is also the description of OLDSTATE.


Ok, thanks.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: parse-partial-sexp parses only Lisp?
  2008-04-02 17:58       ` Lennart Borgman (gmail)
@ 2008-04-05 20:42         ` David Hansen
  0 siblings, 0 replies; 8+ messages in thread
From: David Hansen @ 2008-04-05 20:42 UTC (permalink / raw)
  To: emacs-devel

On Wed, 02 Apr 2008 19:58:18 +0200 Lennart Borgman wrote:

> 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.)

You can use `font-lock-syntactic-keywords' and
`parse-sexp-lookup-properties'.

BTW, in some source file I read that font-lock-syntactic-keywords should
be made independent of font-lock.  Is there anything planned in this
direction?

I think syntax-ppss does the same as parse-partial-sexp except that it
automatically caches a state.

David





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-04-05 20:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01 22:23 parse-partial-sexp parses only Lisp? Lennart Borgman (gmail)
2008-04-02  8:46 ` martin rudalics
2008-04-02 14:59   ` Lennart Borgman (gmail)
2008-04-02 16:59     ` martin rudalics
2008-04-02 17:58       ` Lennart Borgman (gmail)
2008-04-05 20:42         ` David Hansen
2008-04-02 17:38     ` Stefan Monnier
2008-04-02 17:59       ` Lennart Borgman (gmail)

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.