emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode 6a30c39 447/468: lua-is-continuing-statement-p: s


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 6a30c39 447/468: lua-is-continuing-statement-p: short-circuit to false for "breaker" kws
Date: Thu, 5 Aug 2021 04:59:26 -0400 (EDT)

branch: elpa/lua-mode
commit 6a30c39a0bc1217f1678122b9aa112e620782d80
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    lua-is-continuing-statement-p: short-circuit to false for "breaker" kws
---
 lua-mode.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lua-mode.el b/lua-mode.el
index 9bdf532..48598e1 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1391,6 +1391,16 @@ previous one even though it looked like an 
end-of-statement.")
                      (if (eql start-pos end-pos) start-pos (match-beginning 0))
                      (if (eql start-pos end-pos) start-pos (match-end 0))))))))
 
+(defun lua--continuation-breaking-line-p ()
+  "Return non-nil if looking at token(-s) that forbid continued line."
+  (save-excursion
+    (lua-skip-ws-and-comments-forward (line-end-position))
+    (looking-at (lua-rx (or (symbol "do" "while" "repeat" "until"
+                                 "if" "then" "elseif" "else"
+                                 "for" "local")
+                         lua-funcheader)))))
+
+
 (defun lua-is-continuing-statement-p-1 ()
   "Return non-nil if current lined continues a statement.
 
@@ -1404,6 +1414,7 @@ The criteria for a continuing statement are:
   (let (prev-line continuation-pos parent-block-opener)
     (save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back)))
     (and prev-line
+         (not (lua--continuation-breaking-line-p))
          (or
           ;; Binary operator or keyword that implies continuation.
           (save-excursion



reply via email to

[Prev in Thread] Current Thread [Next in Thread]