summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/syntax.texi5
-rw-r--r--lisp/emacs-lisp/syntax.el4
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index b0c04ef9c25..63d534dd134 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -882,6 +882,11 @@ The value is @code{nil} if @var{state} represents a parse which has
arrived at a top level position.
@end defun
+@defun syntax-ppss-context state
+Return @code{string} if @var{state} is a string and @code{comment} if
+it's a comment.
+@end defun
+
@node Low-Level Parsing
@subsection Low-Level Parsing
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 60ed531e63d..6464e2a52db 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -371,6 +371,10 @@ itself at the outermost level), return nil."
(nth 8 ppss)))
(defsubst syntax-ppss-context (ppss)
+ "Say whether PPSS is a string, a comment, or something else.
+If PPSS is a string, the symbol `string' is returned. If it's a
+comment, the symbol `comment' is returned. If it's something
+else, nil is returned."
(cond
((nth 3 ppss) 'string)
((nth 4 ppss) 'comment)