branch: externals/javaimp commit 1e68967c276cd4f3eb8396059c08f8434476f771 Author: Filipp Gunbin <fgun...@fastmail.fm> Commit: Filipp Gunbin <fgun...@fastmail.fm>
* javaimp-parse.el (javaimp-parse--decl-prefix): let instead of setq --- javaimp-parse.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/javaimp-parse.el b/javaimp-parse.el index 61d14910e8..f1f45a43d9 100644 --- a/javaimp-parse.el +++ b/javaimp-parse.el @@ -257,29 +257,29 @@ point (but not farther than BOUND). Matches inside comments / strings are skipped. Return the beginning of the match (then the point is also at that position) or nil (then the point is left unchanged)." - (let (prev-semi pos res) - (javaimp-parse--skip-back-until) - ;; If we skip a previous scope (including unnamed initializers), - ;; or reach enclosing scope start, we'll fail the check in the - ;; below loop. But a semicolon, which delimits statements, will - ;; just be skipped by scan-sexps, so find it and use as bound. - ;; If it is in another scope, that's not a problem, for the same - ;; reasons as described above. - (setq prev-semi (save-excursion - (javaimp-parse--rsb-keyword ";" bound t)) - bound (when (or bound prev-semi) + (javaimp-parse--skip-back-until) + ;; If we skip a previous scope (including unnamed initializers), or + ;; reach enclosing scope start, we'll fail the check in the below + ;; loop. But a semicolon, which delimits statements, will just be + ;; skipped by scan-sexps, so find it and use as bound. If it is in + ;; another scope, that's not a problem, for the same reasons as + ;; described above. + (let* ((prev-semi (save-excursion + (javaimp-parse--rsb-keyword ";" bound t))) + (bound (when (or bound prev-semi) (apply #'max (delq nil (list bound (and prev-semi (1+ prev-semi))))))) + pos res) ;; Go back by sexps (with-syntax-table javaimp--parse-syntax-table (while (and (ignore-errors (setq pos (scan-sexps (point) -1))) (or (not bound) (>= pos bound)) (or (memql (char-after pos) - '(?@ ?\( ;annotation type / args - ?<)) ;generic type + '(?@ ?\( ;annotation type / args + ?<)) ;generic type ;; keyword / identifier first char (= (syntax-class (syntax-after pos)) 2))) ;word (goto-char (setq res pos))))