A parser state is a list of (currently) eleven elements
describing the state of the syntactic parser, after it parses the text
between a specified starting point and a specified end point in the
parse-partial-sexp (see Low-Level Parsing).
Parsing functions such as
(see Finding the Parse State for a Position)
also return a parser state as the value.
can accept a parser state as an argument, for resuming parsing.
Here are the meanings of the elements of the parser state:
nilif inside a string. More precisely, this is the character that will terminate the string, or
tif a generic string delimiter character should terminate it.
tif inside a non-nestable comment (of any comment style; see Syntax Flags); or the comment nesting level if inside a comment that can be nested.
tif the end point is just after a quote character.
nilif not in a comment or in a comment of style ‘a’; 1 for a comment of style ‘b’; 2 for a comment of style ‘c’; and
syntax-tablefor a comment that should be ended by a generic comment delimiter character.
Elements 1, 2, and 6 are ignored in a state which you pass as an
parse-partial-sexp to continue parsing. Elements 9
and 10 are mainly used internally by the parser code.
Some additional useful information is available from a parser state using these functions:
This function extracts, from parser state state, the last position scanned in the parse which was at top level in grammatical structure. “At top level” means outside of any parentheses, comments, or strings.
The value is
nil if state represents a parse which has
arrived at a top level position.
string if the end position of the scan returning
state is in a string, and
comment if it’s in a comment.