[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode ea54e19 196/352: Fontify strings and chars as s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode ea54e19 196/352: Fontify strings and chars as strings, not keywords. |
Date: |
Sun, 29 Aug 2021 11:22:43 -0400 (EDT) |
branch: elpa/julia-mode
commit ea54e19d9229f9c4ba427a82f59d842e2173f651
Author: Wilfred Hughes <me@wilfred.me.uk>
Commit: Yichao Yu <yyc1992@gmail.com>
Fontify strings and chars as strings, not keywords.
This is faster and less code.
---
julia-mode.el | 53 ++++++++++++++++++-----------------------------------
1 file changed, 18 insertions(+), 35 deletions(-)
diff --git a/julia-mode.el b/julia-mode.el
index bbfc535..4504c49 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -82,11 +82,13 @@ This function provides equivalent functionality, but makes
no efforts to optimis
(modify-syntax-entry ?\] ")[ " table)
(modify-syntax-entry ?\( "() " table)
(modify-syntax-entry ?\) ")( " table)
- ;(modify-syntax-entry ?\\ "." table) ; \ is an operator outside quotes
- (modify-syntax-entry ?' "." table) ; character quote or transpose
+ ;; Here, we treat ' as punctuation (when it's used for transpose),
+ ;; see our use of `julia-char-regex' for handling ' as a character
+ ;; delimeter
+ (modify-syntax-entry ?' "." table)
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?` "\"" table)
- ;; (modify-syntax-entry ?\" "." table)
+
(modify-syntax-entry ?. "." table)
(modify-syntax-entry ?? "." table)
(modify-syntax-entry ?$ "." table)
@@ -101,31 +103,16 @@ This function provides equivalent functionality, but
makes no efforts to optimis
table)
"Syntax table for `julia-mode'.")
-;; syntax table that holds within strings
-(defvar julia-mode-string-syntax-table
- (let ((table (make-syntax-table)))
- table)
- "Syntax table for `julia-mode'.")
-
-;; disable " inside char quote
-(defvar julia-mode-char-syntax-table
- (let ((table (make-syntax-table)))
- (modify-syntax-entry ?\" "." table)
- table)
- "Syntax table for `julia-mode'.")
-
-(defconst julia-string-regex
- "\"[^\"]*?\\(\\(\\\\\\\\\\)*\\\\\"[^\"]*?\\)*\"")
-
(defconst julia-char-regex
- (rx (submatch (or (any "-" ";" "\\" "^" "!" "|" "?" "*" "<" "%" "," "=" ">"
"+" "/" "&" "$" "~" ":")
- (syntax open-parenthesis)
- (syntax whitespace)
- bol))
- (submatch "'"
- (or (repeat 0 8 (not (any "'"))) (not (any "\\"))
- "\\\\")
- "'")))
+ (rx (or (any "-" ";" "\\" "^" "!" "|" "?" "*" "<" "%" "," "=" ">" "+" "/"
"&" "$" "~" ":")
+ (syntax open-parenthesis)
+ (syntax whitespace)
+ bol)
+ (group "'")
+ (group
+ (or (repeat 0 8 (not (any "'"))) (not (any "\\"))
+ "\\\\"))
+ (group "'")))
(defconst julia-unquote-regex
"\\(\\s(\\|\\s-\\|-\\|[,%=<>\\+*/?&|!\\^~\\\\;:]\\|^\\)\\($[a-zA-Z0-9_]+\\)")
@@ -208,7 +195,6 @@ This function provides equivalent functionality, but makes
no efforts to optimis
'symbols)
'font-lock-constant-face)
(list julia-unquote-regex 2 'font-lock-constant-face)
- (list julia-char-regex 2 'font-lock-string-face)
(list julia-forloop-in-regex 1 'font-lock-keyword-face)
(list julia-function-regex 1 'font-lock-function-name-face)
(list julia-function-assignment-regex 1 'font-lock-function-name-face)
@@ -405,13 +391,10 @@ before point. Returns nil if we're not within nested
parens."
(set (make-local-variable 'font-lock-defaults) '(julia-font-lock-keywords))
(set (make-local-variable 'font-lock-syntactic-keywords)
(list
- (list "\\(\\\\\\)\\s-*\".*?\"" 1 julia-mode-char-syntax-table)))
- (set (make-local-variable 'font-lock-syntactic-keywords)
- (list
- (list julia-char-regex 2
- julia-mode-char-syntax-table)
- (list julia-string-regex 0
- julia-mode-string-syntax-table)
+ `(,julia-char-regex
+ (1 "\"") ; Treat ' as a string delimiter.
+ (2 ".") ; Don't highlight anything between the open and close '.
+ (3 "\"")) ; Treat the close ' as a string delimiter.
))
(set (make-local-variable 'indent-line-function) 'julia-indent-line)
(set (make-local-variable 'julia-basic-offset) 4)
- [nongnu] elpa/julia-mode 662e153 169/352: Update .mailmap, (continued)
- [nongnu] elpa/julia-mode 662e153 169/352: Update .mailmap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode e4f0b02 167/352: Ensure ! in a macro invocation is highlighted correctly., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 47ad8e4 158/352: add 1607 new LaTeX tab completions from the unicode-math package (closes #7657), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 0b96ff5 170/352: Revert "Update .mailmap", ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d74b8a3 171/352: Use the syntax table to detect if point is in a comment., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 747176f 177/352: fix latex symbol \bot, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode faee243 179/352: Implementing julia-in-string and julia-in-char., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ab58fb7 193/352: Update mailmap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 96d6597 194/352: Fixing highlighting of long character escape sequences., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ca2fe4b 195/352: Removing julia-in-char., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ea54e19 196/352: Fontify strings and chars as strings, not keywords.,
ELPA Syncer <=
- [nongnu] elpa/julia-mode 80c6754 197/352: Silencing byte-compiler warning., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode e4d0e09 199/352: Highlight quoted symbols, e.g. :foo., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4b22a79 205/352: julia-mode.el: remove types that are removed or deprecated, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode f84a425 219/352: Clean up stagedfunction, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode f378cbc 208/352: Mailmap update., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode f3b490b 210/352: Added inferior-julia comint mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8dd023d 223/352: julia-paren-indent: docstring, test, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8d6ea60 233/352: Fix #11549 (top level after paren-indented line), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 9cbde7b 236/352: julia-mode: Move tests to new file and improve, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 1f06e85 234/352: Alias `run-julia` to `inferior-julia` in julia-mode.el, ELPA Syncer, 2021/08/29