Function: semantic-debug-highlight-rule
semantic-debug-highlight-rule is a byte-compiled function defined in
debug.el.gz.
Signature
(semantic-debug-highlight-rule ARG &rest ARGS)
Implementations
(semantic-debug-highlight-rule (IFACE semantic-debug-interface) NONTERM &optional RULE MATCH) in `semantic/debug.el'.
For IFACE, highlight NONTERM in the parser buffer. NONTERM is the name of the rule currently being processed that shows up as a nonterminal (or tag) in the source buffer. If RULE and MATCH indices are specified, highlight those also.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/debug.el.gz
(cl-defmethod semantic-debug-highlight-rule ((iface semantic-debug-interface) nonterm &optional rule match)
"For IFACE, highlight NONTERM in the parser buffer.
NONTERM is the name of the rule currently being processed that shows up
as a nonterminal (or tag) in the source buffer.
If RULE and MATCH indices are specified, highlight those also."
(set-buffer (oref iface parser-buffer))
(let* ((rules (semantic-find-tags-by-class 'nonterminal (current-buffer)))
(nt (semantic-find-first-tag-by-name nonterm rules))
(o nil)
)
(when nt
;; I know it is the first symbol appearing in the body of this token.
(goto-char (semantic-tag-start nt))
(setq o (make-overlay (point) (progn (forward-sexp 1) (point))))
(overlay-put o 'face 'highlight)
(object-add-to-list iface 'overlays o)
(semantic-debug-set-parser-location iface (overlay-start o))
(when (and rule match)
;; Rule, an int, is the rule inside the nonterminal we are following.
(re-search-forward ":\\s-*")
(while (/= 0 rule)
(re-search-forward "^\\s-*|\\s-*")
(setq rule (1- rule)))
;; Now find the match inside the rule
(while (/= 0 match)
(forward-sexp 1)
(skip-chars-forward " \t")
(setq match (1- match)))
;; Now highlight the thingy we find there.
(setq o (make-overlay (point) (progn (forward-sexp 1) (point))))
(overlay-put o 'face 'highlight)
(object-add-to-list iface 'overlays o)
;; If we have a match for a sub-rule, have the parser position
;; move so we can see it in the output window for very long rules.
(semantic-debug-set-parser-location iface (overlay-start o))
))))