diff options
| author | Dmitry Gutov | 2016-03-10 04:13:25 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2016-03-10 14:36:08 +0200 |
| commit | 28532a91a96f30ab468d06b410bd199fb08dd5e9 (patch) | |
| tree | 27d669312c66fd49bf25c9f2081869da4d8de4e7 /lisp/progmodes/ruby-mode.el | |
| parent | a7d6f39d8a291ba78b7605f0e841e2751dfe5e11 (diff) | |
| download | emacs-28532a91a96f30ab468d06b410bd199fb08dd5e9.tar.gz emacs-28532a91a96f30ab468d06b410bd199fb08dd5e9.zip | |
Propertize character literals and special global variables differently
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): Propertize
character literals and global variables with special names with
prefix and symbol syntax classes, for SMIE to tokenize them
together automatically.
(ruby-font-lock-keywords): Fix an old regression in highlighting
character literals.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 0c5e8fe8054..94fd2771ab7 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -1844,13 +1844,15 @@ It will be properly highlighted even when the call omits parens.") | |||
| 1844 | (syntax-propertize-rules | 1844 | (syntax-propertize-rules |
| 1845 | ;; $' $" $` .... are variables. | 1845 | ;; $' $" $` .... are variables. |
| 1846 | ;; ?' ?" ?` are character literals (one-char strings in 1.9+). | 1846 | ;; ?' ?" ?` are character literals (one-char strings in 1.9+). |
| 1847 | ("\\([?$]\\)[#\"'`]" | 1847 | ("\\([?$]\\)[#\"'`:?]" |
| 1848 | (1 (if (save-excursion | 1848 | (1 (if (save-excursion |
| 1849 | (nth 3 (syntax-ppss (match-beginning 0)))) | 1849 | (nth 3 (syntax-ppss (match-beginning 0)))) |
| 1850 | ;; Within a string, skip. | 1850 | ;; Within a string, skip. |
| 1851 | (ignore | 1851 | (ignore |
| 1852 | (goto-char (match-end 1))) | 1852 | (goto-char (match-end 1))) |
| 1853 | (string-to-syntax "\\")))) | 1853 | (put-text-property (match-end 1) (match-end 0) |
| 1854 | 'syntax-table (string-to-syntax "_")) | ||
| 1855 | (string-to-syntax "'")))) | ||
| 1854 | ;; Symbols with special characters. | 1856 | ;; Symbols with special characters. |
| 1855 | ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\)\\)" | 1857 | ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\)\\)" |
| 1856 | (3 (string-to-syntax "_"))) | 1858 | (3 (string-to-syntax "_"))) |
| @@ -2222,7 +2224,7 @@ See `font-lock-syntax-table'.") | |||
| 2222 | 1 font-lock-negation-char-face) | 2224 | 1 font-lock-negation-char-face) |
| 2223 | ;; Character literals. | 2225 | ;; Character literals. |
| 2224 | ;; FIXME: Support longer escape sequences. | 2226 | ;; FIXME: Support longer escape sequences. |
| 2225 | ("\\_<\\?\\\\?\\S " 0 font-lock-string-face) | 2227 | ("\\?\\\\?\\_<.\\_>" 0 font-lock-string-face) |
| 2226 | ;; Regexp options. | 2228 | ;; Regexp options. |
| 2227 | ("\\(?:\\s|\\|/\\)\\([imxo]+\\)" | 2229 | ("\\(?:\\s|\\|/\\)\\([imxo]+\\)" |
| 2228 | 1 (when (save-excursion | 2230 | 1 (when (save-excursion |