diff options
| author | Alan Mackenzie | 2016-03-20 13:19:48 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2016-03-20 13:19:48 +0000 |
| commit | 9dcf5998935c8aaa846d7585b81f0dcfe1935b3d (patch) | |
| tree | 371e627342a753acc111fa1c774cef559407e18f /etc | |
| parent | 565df7265dd73b4812fcb02cd1663fce4dc40be7 (diff) | |
| download | emacs-9dcf5998935c8aaa846d7585b81f0dcfe1935b3d.tar.gz emacs-9dcf5998935c8aaa846d7585b81f0dcfe1935b3d.zip | |
Amend parse-partial-sexp correctly to handle two character comment delimiters
Do this by adding a new field to the parser state: the syntax of the last
character scanned, should that be the first char of a (potential) two char
construct, nil otherwise.
This should make the parser state complete.
Also document element 9 of the parser state. Also refactor the code a bit.
* src/syntax.c (struct lisp_parse_state): Add a new field.
(SYNTAX_FLAGS_COMSTARTEND_FIRST): New function.
(internalize_parse_state): New function, extracted from scan_sexps_forward.
(back_comment): Call internalize_parse_state.
(forw_comment): Return the syntax of the last character scanned to the caller
when that character might be the first of a two character construct.
(Fforward_comment, scan_lists): New dummy variables, passed to forw_comment.
(scan_sexps_forward): Remove a redundant state parameter. Access all `state'
information via the address parameter `state'. Remove the code which converts
from external to internal form of `state'. Access buffer contents only from
`from' onwards. Reformulate code at the top of the main loop correctly to
recognize comment openers when starting in the middle of one. Call
forw_comment with extra argument (for return of syntax value of possible first
char of a two char construct).
(Fparse_partial_sexp): Document elements 9, 10 of the parser state in the
doc string. Clarify the doc string in general. Call
internalize_parse_state. Take account of the new elements when consing up the
output parser state.
* doc/lispref/syntax.texi: (Parser State): Document element 9 and the new
element 10. Minor wording corrections (remove reference to "trivial
cases").
(Low Level Parsing): Minor corrections.
* etc/NEWS: Note new element 10, and documentation of element 9 of parser
state.
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/NEWS | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -175,6 +175,18 @@ a new window when opening man pages when there's already one, use | |||
| 175 | (inhibit-same-window . nil) | 175 | (inhibit-same-window . nil) |
| 176 | (mode . Man-mode)))) | 176 | (mode . Man-mode)))) |
| 177 | 177 | ||
| 178 | +++ | ||
| 179 | ** `parse-partial-sexp' state has a new element. Element 10 is | ||
| 180 | non-nil when the last character scanned might be the first character | ||
| 181 | of a two character construct, i.e. a comment delimiter or escaped | ||
| 182 | character. Its value is the syntax of that last character. | ||
| 183 | |||
| 184 | +++ | ||
| 185 | ** `parse-partial-sexp''s state, element 9, has now been confirmed as | ||
| 186 | permanent and documented, and may be used by Lisp programs. Its value | ||
| 187 | is a list of currently open parenthesis positions, starting with the | ||
| 188 | outermost parenthesis. | ||
| 189 | |||
| 178 | 190 | ||
| 179 | * Changes in Emacs 25.2 on Non-Free Operating Systems | 191 | * Changes in Emacs 25.2 on Non-Free Operating Systems |
| 180 | 192 | ||