branch: externals/javaimp
commit 95b4b9d3accc4360e1c4a9a4ece46f5cd4bab9f7
Author: Filipp Gunbin <[email protected]>
Commit: Filipp Gunbin <[email protected]>
Fix parsing of generic vararg parameters
---
javaimp-parse.el | 8 ++++++--
tests/parse.el | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/javaimp-parse.el b/javaimp-parse.el
index 3ac50c58f1..18e7eaf7b4 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -105,7 +105,8 @@ regexp. First group is directive, second group is
identifier."
;; To be able to skip over generic types as over lists
(modify-syntax-entry ?< "(>" st)
(modify-syntax-entry ?> ")<" st)
- ;; Dot separates parts of fully-qualified type
+ ;; Dot separates parts of fully-qualified type and ellipsis is the
+ ;; vararg suffix
(modify-syntax-entry ?. "_" st) ;
;; Override prefix syntax so that scan-sexps backwards right after
;; @ in annotation doesn't ignore it.
@@ -189,7 +190,10 @@ skipping further backwards is done by the caller."
(lambda (_last-what last-pos)
(save-excursion
(if last-pos (goto-char last-pos))
- (looking-at "\\_<"))))))
+ (and (looking-at "\\_<")
+ ;; Do not stop at vararg ellipsis like in
+ ;; List<String>...
+ (not (string= (current-word t) "..."))))))))
(progn
(unless (eq last-skip t)
(goto-char (cdr last-skip))) ;undo skipping by ..-until
diff --git a/tests/parse.el b/tests/parse.el
index 46d7c98311..e63b9b022b 100644
--- a/tests/parse.el
+++ b/tests/parse.el
@@ -33,6 +33,8 @@
@org.foo.Annotation_2(value_1 = \"value1 , (){}\", value2 = -2.3) String[][]
arr"
("int" . "i")
("String[][]" . "arr"))
+ ("List<String>... lists"
+ ("List<String>..." . "lists"))
))
(javaimp-with-temp-buffer nil
(insert (car data))