Function: wisent-skip-block
wisent-skip-block is a byte-compiled function defined in wisent.el.gz.
Signature
(wisent-skip-block &optional BOUNDS)
Documentation
Safely skip a parenthesized block in order to resume parsing.
Return nil.
Must be used in error recovery semantic actions.
Optional argument BOUNDS is a pair (START . END) which indicates where
the parenthesized block starts. Typically the value of a $regionN
variable, where N is the Nth element of the current rule components
that match the block beginning. It defaults to the value of the
$region variable.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/wisent/wisent.el.gz
(defun wisent-skip-block (&optional bounds)
"Safely skip a parenthesized block in order to resume parsing.
Return nil.
Must be used in error recovery semantic actions.
Optional argument BOUNDS is a pair (START . END) which indicates where
the parenthesized block starts. Typically the value of a `$regionN'
variable, where `N' is the Nth element of the current rule components
that match the block beginning. It defaults to the value of the
`$region' variable."
(let ((start (car (or bounds $region)))
end input)
(if (not (number-or-marker-p start))
;; No nonterminal region available, skip the lookahead token.
(wisent-skip-token)
;; Try to skip a block.
(if (not (setq end (save-excursion
(goto-char start)
(and (looking-at "\\s(")
(condition-case nil
(1- (scan-lists (point) 1 0))
(error nil))))))
;; Not actually a block, skip the lookahead token.
(wisent-skip-token)
;; OK to safely skip the block, so read input until a matching
;; close paren or EOI is encountered.
(setq input wisent-input)
(while (and (not (eq (car input) wisent-eoi-term))
(< (nth 2 input) end))
(run-hook-with-args
'wisent-discarding-token-functions input)
(setq input (wisent-lexer)))
(wisent-message "%s: in enclosing block, skip from %s to %s"
$action
(wisent-token-to-string wisent-input)
(wisent-token-to-string input))
(if (eq (car wisent-input) wisent-eoi-term)
;; Does nothing at EOI to avoid infinite recovery loop.
nil
(wisent-clearin)
(wisent-errok))
;; Set end of $region to end of block.
(wisent-set-region (car $region) (1+ end))
nil))))