;;; semantic/debug.el --- Language Debugger framework
-;; Copyright (C) 2003, 2004, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2008-2015 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;;;###autoload
(make-variable-buffer-local 'semantic-debug-parser-class)
+;;;###autoload
+(defvar semantic-debug-parser-debugger-source nil
+ "Location of the debug parser class.")
+;;;###autoload
+(make-variable-buffer-local 'semantic-debug-parser-source)
+
(defvar semantic-debug-enabled nil
"Non-nil when debugging a parser.")
"The currently displayed frame.")
(overlays :type list
:initarg nil
+ :initform nil
:documentation
"Any active overlays being used to show the debug position.")
)
"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 indicies are specified, highlight those also."
+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)))
;; Install our map onto this buffer
(use-local-map semantic-debug-mode-map)
;; Make the buffer read only
- (toggle-read-only 1)
+ (setq buffer-read-only t)
(set-buffer (oref iface source-buffer))
;; Use our map in the source buffer also
(use-local-map semantic-debug-mode-map)
;; Make the buffer read only
- (toggle-read-only 1)
+ (setq buffer-read-only t)
;; Hooks
(run-hooks 'semantic-debug-mode-hook)
)
(oref semantic-debug-current-interface parser-buffer)
(use-local-map
(oref semantic-debug-current-interface parser-local-map))
+ (setq buffer-read-only nil)
)
(with-current-buffer
(oref semantic-debug-current-interface source-buffer)
(use-local-map
(oref semantic-debug-current-interface source-local-map))
+ (setq buffer-read-only nil)
)
(run-hooks 'semantic-debug-exit-hook)
)))
+;;;###autoload
(defun semantic-debug ()
"Parse the current buffer and run in debug mode."
(interactive)
(error "This major mode does not support parser debugging"))
;; Clear the cache to force a full reparse.
(semantic-clear-toplevel-cache)
+ ;; Load in the debugger for this file.
+ (when semantic-debug-parser-debugger-source
+ (require semantic-debug-parser-debugger-source))
;; Do the parse
(let ((semantic-debug-enabled t)
;; Create an interface
)
(defmethod semantic-debug-parser-go ((parser semantic-debug-parser))
- "Continue executiong in this PARSER until the next breakpoint."
+ "Continue execution in this PARSER until the next breakpoint."
(setq semantic-debug-user-command 'go)
)
(defmethod semantic-debug-parser-fail ((parser semantic-debug-parser))
- "Continue executiong in this PARSER until the next breakpoint."
+ "Continue execution in this PARSER until the next breakpoint."
(setq semantic-debug-user-command 'fail)
)
(defmethod semantic-debug-parser-quit ((parser semantic-debug-parser))
- "Continue executiong in this PARSER until the next breakpoint."
+ "Continue execution in this PARSER until the next breakpoint."
(setq semantic-debug-user-command 'quit)
)
(defmethod semantic-debug-parser-abort ((parser semantic-debug-parser))
- "Continue executiong in this PARSER until the next breakpoint."
+ "Continue execution in this PARSER until the next breakpoint."
(setq semantic-debug-user-command 'abort)
)