branch: externals/sql-indent
commit a6246b20a2546cadae4ffcf33743084174718030
Author: Pierre Téchoueyres <[email protected]>
Commit: Alex Harsányi <[email protected]>

    Detect end of exception block correctly (#30)
---
 sql-indent.el          | 2 +-
 test-data/pr28-syn.eld | 9 ++++++---
 test-data/pr28.sql     | 2 ++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/sql-indent.el b/sql-indent.el
index 73f716d..c34e081 100644
--- a/sql-indent.el
+++ b/sql-indent.el
@@ -1278,7 +1278,7 @@ not a statement-continuation POS is the same as the
 
     ((and (eq syntax-symbol 'in-block)
           (eq (nth 1 syntax) 'exception)
-          (not (looking-at "when\\_>")))
+          (not (looking-at "\\(when\\|end\\)\\_>")))
      (save-excursion
        (when (sqlind-search-backward pos "when\\_>" anchor)
          (push (cons (list 'in-block 'exception-handler) (point)) context))))
diff --git a/test-data/pr28-syn.eld b/test-data/pr28-syn.eld
index a236d25..a1cc207 100644
--- a/test-data/pr28-syn.eld
+++ b/test-data/pr28-syn.eld
@@ -80,8 +80,8 @@
  (((in-block exception-handler "")
    . 486)
   (statement-continuation . 486))
- (((in-block exception-handler)
-   . 486)
+ (((block-end nil "")
+   . 70)
   ((in-block exception "")
    . 364))
  (((block-end toplevel-block "")
@@ -95,5 +95,8 @@
   (toplevel . 1))
  ((comment-start . 1)
   (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
+ ((comment-start . 1)
+  (toplevel . 1))
  ((toplevel . 1)))
- 
diff --git a/test-data/pr28.sql b/test-data/pr28.sql
index b8c3610..387e13d 100644
--- a/test-data/pr28.sql
+++ b/test-data/pr28.sql
@@ -31,5 +31,7 @@ begin
 end;
 /
 -- Local Variables:
+-- mode: sqlind-minor
+-- mode: sql
 -- sql-product: oracle
 -- End:

Reply via email to