diff options
| author | Joakim Verona | 2013-07-02 22:46:17 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-07-02 22:46:17 +0200 |
| commit | 3718127221fbbc31f8ebd027ab7c95403dbe9118 (patch) | |
| tree | ef422898f3344c8f94f6ecf63eb583122bbf2bd8 /lisp/progmodes/ruby-mode.el | |
| parent | 1ce45b902c67b8a0dda8d71bd2812de29a9988a6 (diff) | |
| parent | a3b49114c186d84404226af75ae7905bd1cd018f (diff) | |
| download | emacs-3718127221fbbc31f8ebd027ab7c95403dbe9118.tar.gz emacs-3718127221fbbc31f8ebd027ab7c95403dbe9118.zip | |
Merge branch 'trunk' into xwidget
Conflicts:
src/window.c
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 77 |
1 files changed, 54 insertions, 23 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index fa4efe49b7b..0292e40b986 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -1368,7 +1368,10 @@ It will be properly highlighted even when the call omits parens.") | |||
| 1368 | (defvar ruby-syntax-before-regexp-re | 1368 | (defvar ruby-syntax-before-regexp-re |
| 1369 | (concat | 1369 | (concat |
| 1370 | ;; Special tokens that can't be followed by a division operator. | 1370 | ;; Special tokens that can't be followed by a division operator. |
| 1371 | "\\(^\\|[[=(,~?:;<>]" | 1371 | "\\(^\\|[[=(,~;<>]" |
| 1372 | ;; Distinguish ternary operator tokens. | ||
| 1373 | ;; FIXME: They don't really have to be separated with spaces. | ||
| 1374 | "\\|[?:] " | ||
| 1372 | ;; Control flow keywords and operators following bol or whitespace. | 1375 | ;; Control flow keywords and operators following bol or whitespace. |
| 1373 | "\\|\\(?:^\\|\\s \\)" | 1376 | "\\|\\(?:^\\|\\s \\)" |
| 1374 | (regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and" | 1377 | (regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and" |
| @@ -1419,7 +1422,9 @@ It will be properly highlighted even when the call omits parens.") | |||
| 1419 | ("^\\(=\\)begin\\_>" (1 "!")) | 1422 | ("^\\(=\\)begin\\_>" (1 "!")) |
| 1420 | ;; Handle here documents. | 1423 | ;; Handle here documents. |
| 1421 | ((concat ruby-here-doc-beg-re ".*\\(\n\\)") | 1424 | ((concat ruby-here-doc-beg-re ".*\\(\n\\)") |
| 1422 | (7 (unless (ruby-singleton-class-p (match-beginning 0)) | 1425 | (7 (unless (or (nth 8 (save-excursion |
| 1426 | (syntax-ppss (match-beginning 0)))) | ||
| 1427 | (ruby-singleton-class-p (match-beginning 0))) | ||
| 1423 | (put-text-property (match-beginning 7) (match-end 7) | 1428 | (put-text-property (match-beginning 7) (match-end 7) |
| 1424 | 'syntax-table (string-to-syntax "\"")) | 1429 | 'syntax-table (string-to-syntax "\"")) |
| 1425 | (ruby-syntax-propertize-heredoc end)))) | 1430 | (ruby-syntax-propertize-heredoc end)))) |
| @@ -1723,19 +1728,18 @@ See `font-lock-syntax-table'.") | |||
| 1723 | ;; functions | 1728 | ;; functions |
| 1724 | '("^\\s *def\\s +\\([^( \t\n]+\\)" | 1729 | '("^\\s *def\\s +\\([^( \t\n]+\\)" |
| 1725 | 1 font-lock-function-name-face) | 1730 | 1 font-lock-function-name-face) |
| 1726 | ;; keywords | 1731 | (list (concat |
| 1727 | (cons (concat | 1732 | "\\(^\\|[^.@$]\\|\\.\\.\\)\\(" |
| 1728 | "\\(^\\|[^.@$]\\|\\.\\.\\)\\_<\\(defined\\?\\|" | 1733 | ;; keywords |
| 1729 | (regexp-opt | 1734 | (regexp-opt |
| 1730 | '("alias_method" | 1735 | '("alias" |
| 1731 | "alias" | ||
| 1732 | "and" | 1736 | "and" |
| 1733 | "begin" | 1737 | "begin" |
| 1734 | "break" | 1738 | "break" |
| 1735 | "case" | 1739 | "case" |
| 1736 | "catch" | ||
| 1737 | "class" | 1740 | "class" |
| 1738 | "def" | 1741 | "def" |
| 1742 | "defined?" | ||
| 1739 | "do" | 1743 | "do" |
| 1740 | "elsif" | 1744 | "elsif" |
| 1741 | "else" | 1745 | "else" |
| @@ -1745,21 +1749,15 @@ See `font-lock-syntax-table'.") | |||
| 1745 | "end" | 1749 | "end" |
| 1746 | "if" | 1750 | "if" |
| 1747 | "in" | 1751 | "in" |
| 1748 | "module_function" | ||
| 1749 | "module" | 1752 | "module" |
| 1750 | "next" | 1753 | "next" |
| 1751 | "not" | 1754 | "not" |
| 1752 | "or" | 1755 | "or" |
| 1753 | "public" | ||
| 1754 | "private" | ||
| 1755 | "protected" | ||
| 1756 | "raise" | ||
| 1757 | "redo" | 1756 | "redo" |
| 1758 | "rescue" | 1757 | "rescue" |
| 1759 | "retry" | 1758 | "retry" |
| 1760 | "return" | 1759 | "return" |
| 1761 | "then" | 1760 | "then" |
| 1762 | "throw" | ||
| 1763 | "super" | 1761 | "super" |
| 1764 | "unless" | 1762 | "unless" |
| 1765 | "undef" | 1763 | "undef" |
| @@ -1767,10 +1765,40 @@ See `font-lock-syntax-table'.") | |||
| 1767 | "when" | 1765 | "when" |
| 1768 | "while" | 1766 | "while" |
| 1769 | "yield") | 1767 | "yield") |
| 1770 | t) | 1768 | 'symbols) |
| 1771 | "\\)" | 1769 | "\\|" |
| 1772 | ruby-keyword-end-re) | 1770 | ;; keyword-like methods on Kernel and Module |
| 1773 | 2) | 1771 | (regexp-opt |
| 1772 | '("alias_method" | ||
| 1773 | "autoload" | ||
| 1774 | "attr" | ||
| 1775 | "attr_accessor" | ||
| 1776 | "attr_reader" | ||
| 1777 | "attr_writer" | ||
| 1778 | "catch" | ||
| 1779 | "define_method" | ||
| 1780 | "extend" | ||
| 1781 | "fail" | ||
| 1782 | "include" | ||
| 1783 | "lambda" | ||
| 1784 | "loop" | ||
| 1785 | "module_function" | ||
| 1786 | "private" | ||
| 1787 | "proc" | ||
| 1788 | "protected" | ||
| 1789 | "public" | ||
| 1790 | "raise" | ||
| 1791 | "refine" | ||
| 1792 | "require" | ||
| 1793 | "require_relative" | ||
| 1794 | "throw" | ||
| 1795 | "using") | ||
| 1796 | 'symbols) | ||
| 1797 | "\\)") | ||
| 1798 | 2 | ||
| 1799 | '(if (match-beginning 4) | ||
| 1800 | font-lock-builtin-face | ||
| 1801 | font-lock-keyword-face)) | ||
| 1774 | ;; here-doc beginnings | 1802 | ;; here-doc beginnings |
| 1775 | `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0)) | 1803 | `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0)) |
| 1776 | 'font-lock-string-face)) | 1804 | 'font-lock-string-face)) |
| @@ -1854,11 +1882,14 @@ The variable `ruby-indent-level' controls the amount of indentation. | |||
| 1854 | ;;; Invoke ruby-mode when appropriate | 1882 | ;;; Invoke ruby-mode when appropriate |
| 1855 | 1883 | ||
| 1856 | ;;;###autoload | 1884 | ;;;###autoload |
| 1857 | (add-to-list 'auto-mode-alist (cons (purecopy "\\.rb\\'") 'ruby-mode)) | 1885 | (add-to-list 'auto-mode-alist |
| 1858 | ;;;###autoload | 1886 | (cons (purecopy (concat "\\(?:\\." |
| 1859 | (add-to-list 'auto-mode-alist (cons (purecopy "Rakefile\\'") 'ruby-mode)) | 1887 | "rb\\|ru\\|rake\\|thor" |
| 1860 | ;;;###autoload | 1888 | "\\|jbuilder\\|gemspec" |
| 1861 | (add-to-list 'auto-mode-alist (cons (purecopy "\\.gemspec\\'") 'ruby-mode)) | 1889 | "\\|/" |
| 1890 | "\\(?:Gem\\|Rake\\|Cap\\|Thor" | ||
| 1891 | "Vagrant\\|Guard\\)file" | ||
| 1892 | "\\)\\'")) 'ruby-mode)) | ||
| 1862 | 1893 | ||
| 1863 | ;;;###autoload | 1894 | ;;;###autoload |
| 1864 | (dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8")) | 1895 | (dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8")) |