[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/scala-mode f5280ad 137/217: forward-token for #75
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/scala-mode f5280ad 137/217: forward-token for #75 |
Date: |
Sun, 29 Aug 2021 11:30:59 -0400 (EDT) |
branch: elpa/scala-mode
commit f5280ad7493fe47e96bcac568132e6e92f838880
Author: Heikki Vesalainen <heikkivesalainen@yahoo.com>
Commit: Heikki Vesalainen <heikkivesalainen@yahoo.com>
forward-token for #75
---
scala-mode2-syntax.el | 46 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/scala-mode2-syntax.el b/scala-mode2-syntax.el
index 1df4456..406d1d8 100644
--- a/scala-mode2-syntax.el
+++ b/scala-mode2-syntax.el
@@ -220,7 +220,7 @@
(defun scala-syntax:regexp-for-id (id)
- (let ((prefix-regex
+ (let ((prefix-regex
(if (string-match scala-syntax:alphaid-re id)
"\\b" (concat "\\(^\\|[^" scala-syntax:opchar-group "]\\)")))
(suffix-regex
@@ -555,7 +555,7 @@ characters and one-line strings will not be fontified."
(defun scala-syntax:propertize-underscore-and-idrest (start end)
"Mark all underscores (_) as symbol constituents (syntax 3) or
upper case letter (syntax 2). Also mark opchars in idrest as
-symbol constituents (syntax 3)"
+symbol constituents (syntax 3)."
(save-excursion
(goto-char start)
(while (re-search-forward "_" end t)
@@ -577,14 +577,12 @@ symbol constituents (syntax 3)"
(scala-syntax:put-syntax-table-property 0 '(3 . nil)))
'(3 . nil))))))))) ;; symbol constituent syntax (3) also for
the '_'
-
(defun scala-syntax:propertize (start end)
"See syntax-propertize-function"
(scala-syntax:propertize-char-and-string-literals start end)
(scala-syntax:propertize-shell-preamble start end)
(scala-syntax:propertize-underscore-and-idrest start end))
-
;;;;
;;;; Syntax navigation functions
;;;;
@@ -781,10 +779,10 @@ point 'point') as specified by SLS chapter 1.2"
(not (looking-at
scala-syntax:class-or-object-re)))))))))))))
(defun scala-syntax:forward-sexp ()
- "Move forward one scala expression. It can be: paramter list (value or type),
-id, reserved symbol, keyword, block, or literal. Delimiters (.,;)
+ "Move forward one scala expression. It can be: parameter list (value or
type),
+id, reserved symbol, keyword, block, or literal. Punctuation (.,;)
and comments are skipped silently. Position is placed at the
-beginning of the skipped expression."
+end of the skipped expression."
(interactive)
(syntax-propertize (point-max))
;; emacs knows how to properly skip: lists, varid, capitalid,
@@ -801,6 +799,40 @@ beginning of the skipped expression."
(when (= (skip-syntax-forward ".") 0)
(goto-char (or (scan-sexps (point) 1) (buffer-end 1)))))
+(defun scala-syntax:forward-token ()
+ "Move forward one scala token, comment word or string word. It
+can be: start or end of list (value or type), id, reserved
+symbol, keyword, block, or literal. Punctuation (.,;), comment
+delimiters and string delimiters are skipped silently. Position
+is placed at the end of the skipped token."
+ (interactive)
+ (syntax-propertize (point-max))
+ (skip-syntax-forward " >" (point-max))
+ (when (looking-at
+ (concat "\\([#@:]\\|" scala-syntax:double-arrow-unsafe-re
+ "\\|:>\\|<:\\)" scala-syntax:after-reserved-symbol-re))
+ (goto-char (match-end 1)))
+ (let ((syntax (char-syntax (char-after)))
+ (state (syntax-ppss)))
+ (cond
+ ((or (nth 4 state) (nth 3 state))
+ ;; inside a string or comment, skip words as normal unless that
+ ;; would end up outside the string. Then leave point at end of
+ ;; string delimiter.
+ (let ((start (nth 8 state))
+ (end (save-excursion (forward-word) (point))))
+ (if (eq (nth 8 (save-excursion (syntax-ppss end))) start)
+ (goto-char end)
+ (while (eq (nth 8 (syntax-ppss)) start)
+ (forward-char)))))
+ ;; list start or end
+ ((or (= syntax ?\)) (= syntax ?\()) (forward-char))
+ ;; comment or string start is skipped
+ ((looking-at "\\(//\\|/\\*+\\|\"\\(\"\"\\)?\\)")
+ (goto-char (match-end 1)))
+ ;; otherwise forward-sexp
+ (t (forward-sexp)))))
+
(defun scala-syntax:backward-sexp ()
"Move backward one scala expression. It can be: parameter
list (value or type), id, reserved symbol, keyword, block, or
- [nongnu] elpa/scala-mode 17c6306 070/217: Highlight "var"s differently., (continued)
- [nongnu] elpa/scala-mode 17c6306 070/217: Highlight "var"s differently., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f76902a 105/217: Merge pull request #53 from jjl/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 9cfc522 110/217: fix to scala-indent:fix-line, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode cc5b9b0 116/217: typo fix: ident vs. indent, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 0c39da9 114/217: upgraded version to 0.22 since we added new functionality required by sbt-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode df36b5c 117/217: fix README.md text, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode c21f88f 124/217: Merge pull request #61 from nicferrier/marmalade, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f431bb3 123/217: remove the attempt at checking executables, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 13ad3ac 132/217: Added Jim Powers to list of contributors, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode d27a39b 130/217: added Tillmann Rendel to the list of commiters, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode f5280ad 137/217: forward-token for #75,
ELPA Syncer <=
- [nongnu] elpa/scala-mode e6967f7 154/217: Add Ivan Malison as a contributor., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 3953269 127/217: Tweaked syntax rules to make highlighting more customizeable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode c0842f6 157/217: Use cl functions to avoid mapcan missing error., ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode d1fbe2d 171/217: Implemented prettify/conceal with a base set of rules. (#108), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 2e8fd35 180/217: Fix for fill-paragraph with prefix arg. Fixes #125. (#126), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 7e63002 182/217: Add "inline" keyword from scalameta (#128), ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 1357eba 183/217: Fix for #94, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 730e16d 186/217: Merge pull request #130 from ensime/fix/120, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 1dd5825 085/217: Added comment syntax for bash preambles (#!...!#) in scala script files, ELPA Syncer, 2021/08/29
- [nongnu] elpa/scala-mode 16d6f36 067/217: Added a not to README about font-lock-doc-face, ELPA Syncer, 2021/08/29