Mercurial > emacs
comparison lisp/emacs-lisp/syntax.el @ 74600:ab428131b528
(syntax-ppss-toplevel-pos): New fun.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 12 Dec 2006 02:36:38 +0000 |
parents | 53adfd470fe4 |
children | 80f7458bbb20 6588c6259dfb |
comparison
equal
deleted
inserted
replaced
74599:37d6b6cd4b63 | 74600:ab428131b528 |
---|---|
49 | 49 |
50 (defvar font-lock-beginning-of-syntax-function) | 50 (defvar font-lock-beginning-of-syntax-function) |
51 | 51 |
52 (defsubst syntax-ppss-depth (ppss) | 52 (defsubst syntax-ppss-depth (ppss) |
53 (nth 0 ppss)) | 53 (nth 0 ppss)) |
54 | |
55 (defun syntax-ppss-toplevel-pos (ppss) | |
56 "Return the last preceding position at toplevel. | |
57 \"At toplevel\" means that it is outside of any syntactic entity: | |
58 outside of any parentheses, or comments, or strings. | |
59 Returns nil iff PPSS itself corresponds to a toplevel position." | |
60 (or (car (nth 9 ppss)) | |
61 (nth 8 ppss))) | |
54 | 62 |
55 (defsubst syntax-ppss-context (ppss) | 63 (defsubst syntax-ppss-context (ppss) |
56 (cond | 64 (cond |
57 ((nth 3 ppss) 'string) | 65 ((nth 3 ppss) 'string) |
58 ((nth 4 ppss) 'comment) | 66 ((nth 4 ppss) 'comment) |