branch: externals/sql-indent
commit d410084e79950a80665e879c5f5457c64d284a50
Merge: 03ecdab dc44adc
Author: Alex Harsányi <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #13 from PierreTechoueyres/pte/sqlind-align-rules
    
    Add support for assignment and arrow (=>) in align.
---
 sql-indent.el | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/sql-indent.el b/sql-indent.el
index e0ef9d3..2cd6221 100644
--- a/sql-indent.el
+++ b/sql-indent.el
@@ -1798,21 +1798,41 @@ determine how to indent each type of syntactic element."
 ;;; alignment rules
 
 (defvar sqlind-align-rules
-  ;; Line up he two sides of an equal sign in an update expression
-  `((sql-update-lineup-equals
-     (regexp . , ".*?\\(\\s *\\)=\\(\\s *\\).*")
-     (modes . '(sql-mode))
-     (group . (1 2))
+  '(;; Line up the two side of arrow =>
+    (sql-arrow-lineup
+     (regexp . "\\(\\s-*\\)=>\\(\\s-*\\)")
+     (modes quote (sql-mode))
+     (group 1 2)
      (case-fold . t)
      (repeat . t))
-    ;; lineup the column aliases (the "as name" part) in a select statement
-    (sql-sqlect-lineup-column-names
-     (regexp . , ".*?\\(\\s +\\)as\\(\\s +\\).*")
-     (modes . '(sql-mode))
-     (group . (1 2))
+    ;; Line up the two sides of an assigment
+    (sql-assign-lineup
+     (regexp . "\\(\\s-*\\):=\\(\\s-*\\)")
+     (modes quote (sql-mode))
+     (group 1 2)
+     (case-fold . t)
+     (repeat . t))
+    ;; Line up the two sides of in / out / in out parameter
+    (sql-param-lineup-in-out
+     (regexp . "\\(\\s-+\\)\\(in out\\|in\\|out\\)\\(\\s-+\\)")
+     (modes quote (sql-mode))
+     (group 1 3)
      (case-fold . t)
      (repeat . t))
-    )
+    ;; Line up the two sides of an equal sign in an update expression
+    (sql-equals
+     (regexp . "\\(\\s-*[^:]\\)=\\([^>]\\s-*\\)")
+     (modes quote (sql-mode))
+     (group 1 2)
+     (case-fold . t)
+     (repeat . t))
+    ;; lineup the column aliases (the "as name" part) in a select statement
+    (sql-select-lineup-column-names
+     (regexp . ".*?\\(\\s +\\)as\\(\\s +\\).*")
+     (modes quote (sql-mode))
+     (group 1 2)
+     (case-fold . t)
+     (repeat . t)))
   "Align rules for SQL codes.
 
 These rules help aligning some SQL statements, such as the column

Reply via email to