Add a new ppss structure for syntax-ppss data

* lisp/emacs-lisp/syntax.el (ppss): Add a new structure to provide
accessors to the syntax-ppss data.
This commit is contained in:
Lars Ingebrigtsen 2019-10-30 21:25:23 +01:00
parent b21ea56edc
commit f7673c147c

View file

@ -85,6 +85,40 @@ Put first the functions more likely to cause a change and cheaper to compute.")
;; (i.e. doesn't obey the element t in the buffer-local value).
(make-variable-buffer-local 'syntax-propertize-extend-region-functions)
(cl-defstruct (ppss
(:constructor make-ppss)
(:copier nil)
(:type list))
(depth nil :documentation "depth in parens")
(innermost-start
nil :documentation
"character address of start of innermost containing list; nil if none.")
(last-complete-sexp-start
nil :documentation
"character address of start of last complete sexp terminated.")
(string-terminator nil :documentation "\
non-nil if inside a string.
(it is the character that will terminate the string, or t if the
string should be terminated by a generic string delimiter.)")
(comment-nesting nil :documentation "\
nil if outside a comment, t if inside a non-nestable comment,
else an integer (the current comment nesting).")
(after-quote-p nil :documentation "t if following a quote character.")
(minimum-paren-depth
nil :documentation "the minimum paren-depth encountered during this scan.")
(comment-style nil :documentation "style of comment, if any.")
(comment-or-string-start
nil :documentation
"character address of start of comment or string; nil if not in one.")
(open-paren-positions
nil :documentation
"List of positions of currently open parens, outermost first.")
(two-character-syntax nil :documentation "\
When the last position scanned holds the first character of a
(potential) two character construct, the syntax of that position,
otherwise nil. That construct can be a two character comment
delimiter or an Escaped or Char-quoted character."))
(defun syntax-propertize-wholelines (start end)
(goto-char start)
(cons (line-beginning-position)