summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-06-24 04:24:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-06-24 04:24:09 +0000
commit031d2e84df58ed54948671931544c41cf32da1ca (patch)
tree1118362b178f55bf14d142752b8d61976191b991 /misc
parent37bcc42c983987ec504efd9556f0cb884f0b424d (diff)
990624
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc')
-rw-r--r--misc/ruby-mode.el63
-rw-r--r--misc/rubydb3x.el36
2 files changed, 61 insertions, 38 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 0623e2dec5..bd4ab1b988 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -632,17 +632,30 @@ An end of a defun is found by moving forward from the beginning of one."
("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl)
("^\\s *\\<\\(class\\|def\\|module\\)\\>" "[)\n;]" defun)
("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\)\\>[^_]" 1 defun)
- ("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|self\\|nil\\)\\>[^_]" 1 keyword)
+ ("[^_]\\<\\(and\\|break\\|next\\|raise\\|fail\\|in\\|not\\|or\\|redo\\|retry\\|return\\|super\\|yield\\|catch\\|throw\\|self\\|nil\\)\\>[^_]" 1 keyword)
("\\$\\(.\\|\\sw+\\)" nil type)
("[$@].[a-zA-Z_0-9]*" nil struct)
("^__END__" nil label))))
)
- (or (boundp 'font-lock-variable-name-face)
- (setq font-lock-variable-name-face font-lock-type-face))
- (defvar ruby-font-lock-keywords
- (list
- (cons (concat
- "\\(^\\|[^_:.]\\|\\.\\.\\)\\b\\("
+
+(or (boundp 'font-lock-variable-name-face)
+ (setq font-lock-variable-name-face font-lock-type-face))
+
+(defun ruby-font-lock-docs (limit)
+ (if (re-search-forward "^=begin\\s *" limit t)
+ (let (beg)
+ (beginning-of-line)
+ (setq beg (point))
+ (forward-line 1)
+ (if (re-search-forward "^=end\\s *" limit t)
+ (progn
+ (set-match-data (list beg (point)))
+ t)))))
+
+(defvar ruby-font-lock-keywords
+ (list
+ (cons (concat
+ "\\(^\\|[^_:.]\\|\\.\\.\\)\\b\\("
(mapconcat
'identity
'("alias"
@@ -650,6 +663,7 @@ An end of a defun is found by moving forward from the beginning of one."
"begin"
"break"
"case"
+ "catch"
"class"
"def"
"do"
@@ -671,6 +685,7 @@ An end of a defun is found by moving forward from the beginning of one."
"retry"
"return"
"then"
+ "throw"
"self"
"super"
"unless"
@@ -681,19 +696,25 @@ An end of a defun is found by moving forward from the beginning of one."
)
"\\|")
"\\)\\b")
- 2)
- ;; variables
- '("\\b\\(nil\\|self\\|true\\|false\\)\\b"
- 1 font-lock-variable-name-face)
- ;; variables
- '("[$@].[a-zA-Z0-9_]*"
- 0 font-lock-variable-name-face)
- ;; constants
- '("\\(^\\|[^_]\\)\\b\\([A-Z]+[a-zA-Z0-9_]*\\)"
- 2 font-lock-type-face)
- ;; functions
- '("^\\s *def\\s *\\<\\(\\(\\w\\|\\s_\\)+\\.\\)?\\(\\(\\w\\|\\s_\\)+\\)\\>"
- 3 font-lock-function-name-face t))
- "*Additional expressions to highlight in ruby mode.")
+ 2)
+ ;; variables
+ '("\\b\\(nil\\|self\\|true\\|false\\)\\b"
+ 1 font-lock-variable-name-face)
+ ;; variables
+ '("[$@].\\(\\w\\|_\\)*"
+ 0 font-lock-variable-name-face)
+ ;; embedded document
+ '(ruby-font-lock-docs
+ 0 font-lock-comment-face t)
+ ;; constants
+ '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
+ 2 font-lock-type-face)
+ ;; functions
+ '("^\\s *def\\s *\\<\\(\\(\\w\\|_\\)+\\(\\.\\|::\\)\\)?\\(\\(\\w\\|_\\)+\\??\\)\\>"
+ 4 font-lock-function-name-face t)
+ ;; symbols
+ '("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b"
+ 2 font-lock-reference-face t))
+ "*Additional expressions to highlight in ruby mode.")
(provide 'ruby-mode)
diff --git a/misc/rubydb3x.el b/misc/rubydb3x.el
index 9d4e31f90e..197dd5327c 100644
--- a/misc/rubydb3x.el
+++ b/misc/rubydb3x.el
@@ -8,7 +8,7 @@
(defvar gud-rubydb-history nil)
(defun gud-rubydb-massage-args (file args)
- (cons "-r" (cons "debug" args)))
+ (cons "-r" (cons "debug" (cons file args))))
;; There's no guarantee that Emacs will hand the filter the entire
;; marker at once; it could be broken up across several strings. We
@@ -19,46 +19,46 @@
(defvar gud-rubydb-marker-acc "")
(defun gud-rubydb-marker-filter (string)
- (setq gud-marker-acc (concat gud-marker-acc string))
+ (setq gud-rubydb-marker-acc (concat gud-rubydb-marker-acc string))
(let ((output ""))
;; Process all the complete markers in this chunk.
(while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
- gud-marker-acc)
+ gud-rubydb-marker-acc)
(setq
;; Extract the frame position from the marker.
gud-last-frame
- (cons (substring gud-marker-acc (match-beginning 1) (match-end 1))
- (string-to-int (substring gud-marker-acc
+ (cons (substring gud-rubydb-marker-acc (match-beginning 1) (match-end 1))
+ (string-to-int (substring gud-rubydb-marker-acc
(match-beginning 2)
(match-end 2))))
;; Append any text before the marker to the output we're going
;; to return - we don't include the marker in this text.
output (concat output
- (substring gud-marker-acc 0 (match-beginning 0)))
+ (substring gud-rubydb-marker-acc 0 (match-beginning 0)))
;; Set the accumulator to the remaining text.
- gud-marker-acc (substring gud-marker-acc (match-end 0))))
+ gud-rubydb-marker-acc (substring gud-rubydb-marker-acc (match-end 0))))
;; Does the remaining text look like it might end with the
;; beginning of another marker? If it does, then keep it in
- ;; gud-marker-acc until we receive the rest of it. Since we
+ ;; gud-rubydb-marker-acc until we receive the rest of it. Since we
;; know the full marker regexp above failed, it's pretty simple to
;; test for marker starts.
- (if (string-match "\032.*\\'" gud-marker-acc)
+ (if (string-match "\032.*\\'" gud-rubydb-marker-acc)
(progn
;; Everything before the potential marker start can be output.
- (setq output (concat output (substring gud-marker-acc
+ (setq output (concat output (substring gud-rubydb-marker-acc
0 (match-beginning 0))))
;; Everything after, we save, to combine with later input.
- (setq gud-marker-acc
- (substring gud-marker-acc (match-beginning 0))))
+ (setq gud-rubydb-marker-acc
+ (substring gud-rubydb-marker-acc (match-beginning 0))))
- (setq output (concat output gud-marker-acc)
- gud-marker-acc ""))
+ (setq output (concat output gud-rubydb-marker-acc)
+ gud-rubydb-marker-acc ""))
output))
@@ -66,7 +66,7 @@
(save-excursion
(let ((buf (find-file-noselect f)))
(set-buffer buf)
- (gud-make-debug-menu)
+;; (gud-make-debug-menu)
buf)))
(defvar rubydb-command-name "ruby"
@@ -85,8 +85,10 @@ and source-file directory for your debugger."
nil nil
'(gud-rubydb-history . 1))))
- (gud-common-init command-line 'gud-rubydb-massage-args
- 'gud-rubydb-marker-filter 'gud-rubydb-find-file)
+ (gud-overload-functions '((gud-massage-args . gud-rubydb-massage-args)
+ (gud-marker-filter . gud-rubydb-marker-filter)
+ (gud-find-file . gud-rubydb-find-file)))
+ (gud-common-init command-line rubydb-command-name)
(gud-def gud-break "b %l" "\C-b" "Set breakpoint at current line.")
; (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")