[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode d239cdf 072/352: fixing #319. the vast majority
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode d239cdf 072/352: fixing #319. the vast majority of ' and " uses will be highlighted correctly. |
Date: |
Sun, 29 Aug 2021 11:22:17 -0400 (EDT) |
branch: elpa/julia-mode
commit d239cdf0f1becfefc9bbe90b42abba3c6e29d725
Author: Jeff Bezanson <bezanson@post.harvard.edu>
Commit: Yichao Yu <yyc1992@gmail.com>
fixing #319. the vast majority of ' and " uses will be highlighted
correctly.
the problem we gain instead is that \ is an escape character even outside
quotes, so `\"` will fail to start a string. But this character sequence is
easy to avoid, since on the slim chance you need to divide a string, you can
just add a space.
---
julia-mode.el | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/julia-mode.el b/julia-mode.el
index 8a6fb78..bf93b37 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -18,8 +18,9 @@
(modify-syntax-entry ?\] ")[ " table)
(modify-syntax-entry ?\( "() " table)
(modify-syntax-entry ?\) ")( " table)
- (modify-syntax-entry ?\\ "." table) ; \ is an operator outside quotes
- (modify-syntax-entry ?' "w" table) ; character quote, ignored for now
+ ;(modify-syntax-entry ?\\ "." table) ; \ is an operator outside quotes
+ (modify-syntax-entry ?' "." table) ; character quote or transpose
+ ;(modify-syntax-entry ?\" "." table)
(modify-syntax-entry ?? "." table)
(modify-syntax-entry ?$ "." table)
(modify-syntax-entry ?& "." table)
@@ -33,12 +34,25 @@
table)
"Syntax table for julia-mode")
-; syntax table that holds within strings (uses default emacs behavior)
+;; 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
+
"\\(\\s(\\|\\s-\\|-\\|[,%=<>\\+*/?&|$!\\^~\\\\;:]\\|^\\)\\('\\(\\(.*?[^\\\\]\\)\\|\\(\\\\\\\\\\)\\)'\\)")
+
(defconst julia-font-lock-keywords
(list
'("\\<\\(true\\|false\\|\\|Uint\\(8\\|16\\|32\\|64\\)\\|Int\\(8\\|16\\|32\\|64\\)\\|Integer\\|Float\\|Float32\\|Float64\\|Complex128\\|Complex64\\|ComplexNum\\|Bool\\|Char\\|Number\\|Scalar\\|Real\\|Int\\|Uint\\|Array\\|DArray\\|AbstractArray\\|AbstractVector\\|AbstractMatrix\\|SubArray\\|StridedArray\\|StridedVector\\|StridedMatrix\\|VecOrMat\\|StridedVecOrMat\\|Range\\|Range1\\|SparseMatrixCSC\\|Tuple\\|NTuple\\|Buffer\\|Size\\|Index\\|Symbol\\|Function\\|Vector\\|Matrix\\|Unio
[...]
font-lock-type-face)
@@ -52,7 +66,9 @@
"module" "import" "export" "const" "let" "bitstype")
"\\|") "\\)\\>")
'font-lock-keyword-face)
- '("\\\\\\s-*\".*?\"" . font-lock-string-face)))
+ (list julia-char-regex 2 'font-lock-string-face)
+ ;(list julia-string-regex 0 'font-lock-string-face)
+))
(defconst julia-block-start-keywords
(list "if" "while" "for" "begin" "try" "function" "type" "let" "macro"
@@ -210,8 +226,11 @@
; (list "\\(\\\\\\)\\s-*\".*?\"" 1 julia-mode-char-syntax-table)))
(set (make-local-variable 'font-lock-syntactic-keywords)
(list
- (list "\\(\"\\(.\\|\\s-\\)*?[^\\\\]\"\\|\"\"\\)" 0
- julia-mode-string-syntax-table)))
+ (list julia-char-regex 2
+ julia-mode-char-syntax-table)
+; (list julia-string-regex 0
+; julia-mode-string-syntax-table)
+))
(set (make-local-variable 'indent-line-function) 'julia-indent-line)
(set (make-local-variable 'julia-basic-offset) 4)
(setq indent-tabs-mode nil)
- [nongnu] elpa/julia-mode fda4b69 100/352: .mailmap updates, (continued)
- [nongnu] elpa/julia-mode fda4b69 100/352: .mailmap updates, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 0db269d 094/352: fixing missing elisp evenp on some systems, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode ebfc698 108/352: Mailmap update, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4f56f2b 115/352: contrib: update instructions for julia-mode.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode bb4f203 122/352: Revert "Merge in changes from ESS' version of julia-mode.el",, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4c713e1 025/352: adding some thoughts on lightweight threads, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode f75719d 051/352: Update the .mailmap file., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8b30aff 048/352: adding support for comment-related commands to emacs mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8b560d4 070/352: part of issue #301, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode f3c1a65 078/352: highlight Inf[32], NaN[32] as constants in emacs mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d239cdf 072/352: fixing #319. the vast majority of ' and " uses will be highlighted correctly.,
ELPA Syncer <=
- [nongnu] elpa/julia-mode 413f476 082/352: Update mailmap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4f8a1ce 015/352: Rename: Single => Float32, single => float32., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 50b958c 045/352: Add a new mailmap entry for Jeff., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode da04582 069/352: update mailmap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 0cd3b88 065/352: issparse(AbstractArray) should not be false, since AbstractArrays could be sparse., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 0e6ed0c 086/352: Update mailmap, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode a4b62e7 112/352: misc changes for immutable types, updating comments, adding keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4be7bab 111/352: fix #2336, julia-in-comment in emacs mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode bfa6d83 103/352: major update to modules:, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 2316ad7 093/352: implement "do" block syntax. closes #441, ELPA Syncer, 2021/08/29