• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/ruby-106/ruby/misc/

Lines Matching +defs:end +defs:of

13 ;; This file is not part of GNU Emacs. However, a newer version of
14 ;; ruby-mode is included in recent releases of GNU Emacs (version 23
16 ;; with older versions of Emacs or XEmacs. This file is the last
23 ;; it under the terms of the GNU General Public License as published by
24 ;; the Free Software Foundation, either version 3 of the License, or
28 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
32 ;; You should have received a copy of the GNU General Public License
54 (substring ruby-mode-revision (match-beginning 0) (match-end 0)))
57 (defconst ruby-keyword-end-re
64 "Keywords at the beginning of blocks.")
68 "Regexp to match the beginning of blocks.")
71 (concat (regexp-opt '("while" "until" "for" "rescue") t) ruby-keyword-end-re)
81 "Modifiers that are the same as the beginning of blocks.")
85 "Regexp to match modifiers same as the beginning of blocks.")
93 "Keywords where the indentation gets shallower in middle of block statements.")
97 "Regexp to match where the indentation gets shallower in middle of block statements.")
107 (defconst ruby-block-end-re "\\_<end\\_>")
112 (defconst ruby-here-doc-end-re
115 (defun ruby-here-doc-end-match ()
137 "\\)\\_>\\|" ruby-block-end-re
143 ruby-block-end-re "\\|}\\|\\]\\)")
164 (define-key ruby-mode-map "\e\C-a" 'ruby-beginning-of-defun)
165 (define-key ruby-mode-map "\e\C-e" 'ruby-end-of-defun)
168 (define-key ruby-mode-map "\e\C-p" 'ruby-beginning-of-block)
169 (define-key ruby-mode-map "\e\C-n" 'ruby-end-of-block)
173 (define-key ruby-mode-map "\C-c\C-e" 'ruby-insert-end)
219 "*Indentation of ruby statements."
224 "*Indentation column of comments."
254 (defun ruby-imenu-create-index-in-block (prefix beg end)
258 (while (re-search-forward "^\\s *\\(\\(class\\s +\\|\\(class\\s *<<\\s *\\)\\|module\\s +\\)\\([^\(<\n ]+\\)\\|\\(def\\|alias\\)\\s +\\([^\(\n ]+\\)\\)" end t)
261 (setq next (match-end 0))
276 (ruby-accurate-end-of-block end))
282 (ruby-accurate-end-of-block end)
294 (defun ruby-accurate-end-of-block (&optional end)
296 (or end (setq end (point-max)))
297 (while (and (setq state (apply 'ruby-parse-partial end state))
298 (>= (nth 2 state) 0) (< (point) end)))))
310 (make-local-variable 'comment-end)
311 (setq comment-end "")
348 (if (looking-at "^#!") (beginning-of-line 2))
352 (delete-region (point) (match-end 2))
365 (beginning-of-line)
370 "Correct indentation of the current ruby line."
382 (beginning-of-line)
394 (beginning-of-line)
440 (goto-char (match-end 0))
448 (defun ruby-forward-string (term &optional end no-error expand)
453 (while (and (re-search-forward re end no-error)
455 (ruby-forward-string "}{" end no-error nil)
477 (defun ruby-parse-partial (&optional end in-string nest depth pcol indent)
480 (when (re-search-forward ruby-delimiter end 'move)
489 (ruby-forward-string (buffer-substring (point) (1+ (point))) end t t))
493 (goto-char end))))
497 (re-search-forward "[^\\]\\(\\\\\\\\\\)*'" end t))
501 (goto-char end))))
507 (if (ruby-forward-string "/" end t t)
510 (goto-char end)))
529 (unless (cond (re (ruby-forward-string re end t expand))
530 (expand (ruby-forward-string w end t t))
535 end t)))
537 (goto-char end)))
544 (goto-char (match-end 0)))
559 (setq pnt (1- (match-end 0))))
579 ((looking-at ruby-block-end-re)
604 (goto-char (match-end 0)))
608 (or (not (looking-at (concat "do" ruby-keyword-end-re)))
634 (ruby-forward-string (buffer-substring (match-beginning 1) (match-end 1)) end))
636 (goto-char (match-end 0)))
638 (goto-char (match-end 0)))
643 (goto-char (match-end 0)))
645 (if (re-search-forward "^=end" end t)
647 (setq in-string (match-end 0))
648 (goto-char end)))
655 (let* ((id-end (goto-char (match-end 0)))
656 (line-end-position (save-excursion (end-of-line) (point)))
658 ;; parse the rest of the line
659 (while (and (> line-end-position (point))
661 line-end-position state))))
668 (if (re-search-forward (concat "^" re "$") end 'move)
670 (setq in-string id-end)
671 (goto-char end))))
677 (if (re-search-forward (ruby-here-doc-end-match)
680 (setq in-string (match-end 0))
688 (defun ruby-parse-region (start end)
693 (ruby-beginning-of-indent))
695 (narrow-to-region (point) end)
696 (while (and (> end (point))
697 (setq state (apply 'ruby-parse-partial end state))))))
710 (beginning-of-line)
713 state bol eol begin op-end
719 (ruby-beginning-of-indent)
774 (end-of-line)
776 (beginning-of-line)
782 (and (not (eq ?_ (char-after (match-end 0))))
786 (beginning-of-line)
790 ;; goto beginning of non-empty no-comment line
791 (let (end done)
794 (setq end (point))
795 (beginning-of-line)
796 (if (re-search-forward "^\\s *#" end t)
797 (beginning-of-line)
800 (end-of-line)
801 ;; skip the comment at the end
803 (let (end (pos (point)))
804 (beginning-of-line)
806 (setq end (1- (point)))
807 (or (ruby-special-char-p end)
808 (and (setq state (ruby-parse-region parse-start end))
810 (setq end nil))
811 (goto-char (or end pos))
813 (setq begin (if (and end (nth 0 state)) pos (cdr (nth 1 state))))
822 (goto-char (match-end 0))
826 ;; operator at the end of line
853 (setq op-end t)))))
857 (null op-end)
869 (beginning-of-line)
892 (defun-region-command ruby-beginning-of-defun (&optional arg)
893 "Move backward to next beginning-of-defun.
895 Returns t unless search stops due to end of buffer."
899 (progn (beginning-of-line) t)))
901 (defun ruby-beginning-of-indent ()
905 (beginning-of-line)
908 (defun-region-command ruby-end-of-defun (&optional arg)
909 "Move forward to next end of defun.
910 An end of a defun is found by moving forward from the beginning of one."
912 (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\($\\|\\b[^_]\\)")
914 (progn (beginning-of-line) t))
920 (setq down (looking-at (if (< n 0) ruby-block-end-re
928 (re-search-forward "^=end\\>"))
929 ((and (< n 0) (looking-at "^=end\\>"))
957 (defun-region-command ruby-beginning-of-block (&optional arg)
958 "Move backward to next beginning-of-block"
962 (defun-region-command ruby-end-of-block (&optional arg)
963 "Move forward to next beginning-of-block"
975 (if (looking-at ",\\s *") (goto-char (match-end 0)))
977 (goto-char (match-end 0)))
985 (ruby-end-of-block)
1024 (let ((c (char-to-string (char-before (match-end 0)))))
1043 (if (looking-at ruby-block-end-re)
1044 (ruby-beginning-of-block))
1054 (end-of-line 0)
1061 (defun ruby-decomment-region (beg end)
1065 (while (re-search-forward "^\\([ \t]*\\)#" end t)
1070 (defun ruby-insert-end ()
1072 (insert "end")
1074 (end-of-line))
1077 "Put mark at end of this Ruby function, point at beginning."
1080 (ruby-end-of-defun)
1082 (ruby-beginning-of-defun)
1094 (beginning-of-line)
1104 (beginning-of-line 2)))
1127 (beginning-of-line)))
1140 (beginning-of-line))))
1169 (defun ruby-brace-to-do-end ()
1171 (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
1176 (insert "end")
1189 (defun ruby-do-end-to-brace ()
1193 (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
1195 (when (looking-at ruby-block-end-re)
1202 (delete-char (- (match-end 0) (match-beginning 0) 1)))
1207 (or (ruby-brace-to-do-end)
1208 (ruby-do-end-to-brace)))
1241 ("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil))
1245 (,ruby-here-doc-end-re 3 (ruby-here-doc-end-syntax))))
1278 (beginning-of-line)
1283 (ruby-here-doc-find-end old-point)))
1286 (defun ruby-here-doc-find-end (&optional limit)
1290 buffer position `limit' or the end of the buffer."
1292 (beginning-of-line)
1294 (let ((eol (save-excursion (end-of-line) (point)))
1296 ;; Fake match data such that (match-end 0) is at eol
1297 (end-match-data (progn (looking-at ".*$") (match-data)))
1298 beg-match-data end-re)
1301 (setq end-re (ruby-here-doc-end-match))
1303 (set-match-data end-match-data)
1304 (goto-char (match-end 0))
1305 (unless (re-search-forward end-re limit t) (throw 'done nil))
1306 (setq end-match-data (match-data))
1309 (goto-char (match-end 0)))
1310 (set-match-data end-match-data)
1311 (goto-char (match-end 0))
1321 (defun ruby-here-doc-end-syntax ()
1325 (goto-char (nth 8 pss)) ; Go to the beginning of heredoc.
1327 (beginning-of-line)
1330 (progn (goto-char (match-end 0)) ; And it's the last heredoc on its line...
1338 beginning-of-line
1345 (beginning-of-line)
1348 (if (re-search-forward "^=end\\(\\s \\|$\\)" limit t)
1356 (if (and (re-search-backward "^=\\(begin\\|end\\)\\(\\s \\|$\\)" nil t)
1359 (beginning-of-line)
1361 (if (and beg (and (re-search-forward "^=\\(begin\\|end\\)\\(\\s \\|$\\)" nil t)
1362 (string= (match-string 1) "end")))
1396 "end"
1420 ruby-keyword-end-re)
1468 ("[^_]\\<\\(begin\\|case\\|else\\|elsif\\|end\\|ensure\\|for\\|if\\|unless\\|rescue\\|then\\|when\\|while\\|until\\|do\\|yield\\)\\>\\([^_]\\|$\\)" 1 defun)
1478 \\[ruby-indent-command] properly indents subexpressions of multi-line
1482 The variable ruby-indent-level controls the amount of indentation.