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

Lines Matching +defs:indent +defs:string

50   "Ruby mode revision string.")
53 (and (string-match "[0-9.]+" ruby-mode-revision)
58 (if (string-match "\\_>" "ruby")
74 (defconst ruby-indent-beg-re
117 (if (match-string 2) "[ \t]*" nil)
119 (or (match-string 4)
120 (match-string 5)
121 (match-string 6)))))
125 (regexp-quote (concat (match-string 2) (match-string 3)))
126 (if (string= (match-string 3) "_") "\\B" "\\b"))))
128 (let ((match (match-string 1)))
130 (concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) "\\)"
171 (define-key ruby-mode-map "\e\C-q" 'ruby-indent-exp)
172 (define-key ruby-mode-map "\t" 'ruby-indent-command)
174 (define-key ruby-mode-map "\C-j" 'ruby-reindent-then-newline-and-indent)
213 (defcustom ruby-indent-tabs-mode nil
216 (put 'ruby-indent-tabs-mode 'safe-local-variable 'booleanp)
218 (defcustom ruby-indent-level 2
221 (put 'ruby-indent-level 'safe-local-variable 'integerp)
229 "*Deep indent lists in parenthesis when non-nil.
234 (defcustom ruby-deep-indent-paren '(?\( ?\[ ?\] t)
235 "*Deep indent lists in parenthesis when non-nil. t means continuous line.
239 (defcustom ruby-deep-indent-paren-style 'space
240 "Default deep indent style."
251 (defvar ruby-indent-point nil "internal variable")
260 (setq decl (match-string 5))
262 (setq name (or (match-string 4) (match-string 6)))
265 ((string= "alias" decl)
268 ((string= "def" decl)
272 ((string-match "^self\." name)
278 (if (string= "self" name)
304 (make-local-variable 'indent-line-function)
305 (setq indent-line-function 'ruby-indent-line)
316 (setq indent-tabs-mode ruby-indent-tabs-mode)
350 (unless (string= (match-string 2) coding-system)
369 (defun ruby-indent-line (&optional flag)
371 (ruby-indent-to (ruby-calculate-indent)))
373 (defun ruby-indent-command ()
375 (ruby-indent-line t))
377 (defun ruby-indent-to (x)
395 (indent-to x)
448 (defun ruby-forward-string (term &optional end no-error expand)
449 (let ((n 1) (c (string-to-char term))
455 (ruby-forward-string "}{" end no-error nil)
461 ((error "unterminated string")))))
463 (defun ruby-deep-indent-paren-p (c &optional pos)
468 ((listp ruby-deep-indent-paren)
469 (let ((deep (assoc c ruby-deep-indent-paren)))
471 (or (cdr deep) ruby-deep-indent-paren-style))
472 ((memq c ruby-deep-indent-paren)
473 ruby-deep-indent-paren-style))))
474 ((eq c ruby-deep-indent-paren) ruby-deep-indent-paren-style)
477 (defun ruby-parse-partial (&optional end in-string nest depth pcol indent)
479 (or indent (setq indent 0))
486 ((looking-at "[\"`]") ;skip string
489 (ruby-forward-string (buffer-substring (point) (1+ (point))) end t t))
492 (setq in-string (point))
500 (setq in-string (point))
507 (if (ruby-forward-string "/" end t t)
509 (setq in-string (point))
521 (setq w (match-string 1))
523 ((string= w "[") (setq re "]["))
524 ((string= w "{") (setq re "}{"))
525 ((string= w "(") (setq re ")("))
526 ((string= w "<") (setq re "><"))
527 ((and expand (string= w "\\"))
529 (unless (cond (re (ruby-forward-string re end t expand))
530 (expand (ruby-forward-string w end t t))
532 (if (string= w "\\")
536 (setq in-string (point))
555 (let ((deep (ruby-deep-indent-paren-p (char-after))))
568 (if (ruby-deep-indent-paren-p (matching-paren (char-after))
634 (ruby-forward-string (buffer-substring (match-beginning 1) (match-end 1)) end))
647 (setq in-string (match-end 0))
653 (setq re (regexp-quote (or (match-string 4) (match-string 2))))
657 (state (list in-string nest depth pcol indent)))
662 (setq in-string (car state)
666 indent (nth 4 state))
670 (setq in-string id-end)
678 ruby-indent-point t)
680 (setq in-string (match-end 0))
681 (goto-char ruby-indent-point)))
683 (error (format "bad string %s"
686 (list in-string nest depth pcol))
693 (ruby-beginning-of-indent))
698 (list (nth 0 state) ; in-string
702 ;(car (nth 5 state)) ; indent
705 (defun ruby-indent-size (pos nest)
706 (+ pos (* (or nest 1) ruby-indent-level)))
708 (defun ruby-calculate-indent (&optional parse-start)
711 (let ((ruby-indent-point (point))
716 (indent 0))
719 (ruby-beginning-of-indent)
722 (setq indent (current-column))
723 (setq state (ruby-parse-region parse-start ruby-indent-point))
725 ((nth 0 state) ; within string
726 (setq indent nil)) ; do nothing
729 (let ((deep (ruby-deep-indent-paren-p (car (nth 1 state))
734 (setq indent (1- (current-column))))
737 (setq indent (1+ (current-column))))
738 ((let ((s (ruby-parse-region (point) ruby-indent-point)))
742 (setq indent (ruby-indent-size (current-column) (nth 2 state))))
744 (setq indent (current-column))
746 (paren (setq indent (1- indent)))
747 (t (setq indent (ruby-indent-size (1- indent) 1))))))
750 (setq indent (ruby-indent-size (current-column) (nth 2 state))))
752 (ruby-deep-indent-paren-p (matching-paren paren)
754 (search-backward (char-to-string paren))
755 (setq indent (current-column)))))
766 (setq indent (ruby-indent-size (current-column) (nth 2 state))))
768 (setq indent (+ (current-column) ruby-indent-level)))))
771 (setq indent (ruby-indent-size (current-column) (nth 2 state)))))
772 (when indent
773 (goto-char ruby-indent-point)
778 ((and (not (ruby-deep-indent-paren-p paren
783 (setq indent (- indent ruby-indent-level))))
788 (or (ruby-deep-indent-paren-p t)
854 (setq indent
859 (eq (ruby-deep-indent-paren-p t) 'space)
865 ((car (nth 1 state)) indent)
867 (+ indent ruby-indent-level))))))))
868 (goto-char ruby-indent-point)
872 (+ indent ruby-indent-level)
873 indent))))
878 (ruby-indent-line t)
901 (defun ruby-beginning-of-indent ()
902 (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>")
919 (setq start (ruby-calculate-indent))
1024 (let ((c (char-to-string (char-before (match-end 0)))))
1050 (defun ruby-reindent-then-newline-and-indent ()
1055 (indent-according-to-mode)
1057 (indent-according-to-mode))
1068 (ruby-indent-line)))))
1073 (ruby-indent-line t)
1085 (defun ruby-indent-exp (&optional shutup-p)
1098 (setq column (ruby-calculate-indent start))
1103 (ruby-indent-to column)
1109 "Return current method string."
1112 (let (mname mlist (indent 0))
1122 (setq mname (match-string 2))
1123 (unless (string-equal "def" (match-string 1))
1126 (setq indent (current-column))
1129 (while (and (> indent 0)
1136 (if (< (current-column) indent)
1138 (setq mlist (cons (match-string 2) mlist))
1139 (setq indent (current-column))
1142 (let ((mn (split-string mname "\\.\\|::")))
1146 ((string-equal "" (car mn))
1148 ((string-equal "self" (car mn))
1152 (if (string-equal (car ml) (car mn))
1162 ;; generate string
1228 ;; the last $', $", $` in the respective string is not variable
1229 ;; the last ?', ?", ?` in the respective string is not ascii code
1257 ((eq context 'string)
1261 ;; If it's generic string, it's a heredoc and we don't care
1319 (string-to-syntax "|"))))
1329 (not (ruby-in-ppss-context-p 'anything)) ; And that's not inside a heredoc/string/comment...
1332 (string-to-syntax "|")))))))
1357 (string= (match-string 1) "begin"))
1362 (string= (match-string 1) "end")))
1423 (list ruby-here-doc-beg-re 0 'font-lock-string-face)
1437 ;; general delimited string
1439 (2 font-lock-string-face))
1459 '(("[^$\\?]\\(\"[^\\\"]*\\(\\\\\\(.\\|\n\\)[^\\\"]*\\)*\"\\)" 1 string)
1460 ("[^$\\?]\\('[^\\']*\\(\\\\\\(.\\|\n\\)[^\\']*\\)*'\\)" 1 string)
1461 ("[^$\\?]\\(`[^\\`]*\\(\\\\\\(.\\|\n\\)[^\\`]*\\)*`\\)" 1 string)
1464 ("[^a-zA-Z_]\\(\\?\\(\\\\[CM]-\\)*.\\)" 1 string)
1478 \\[ruby-indent-command] properly indents subexpressions of multi-line
1482 The variable ruby-indent-level controls the amount of indentation.