Fix regular expression for end of switch statement
The original regular expression tried to look for a matching closing parenthesis, which failed in case of nested parentheses inside the case statement. This is fixed now, we do not care anymore about whether parentheses match or not.
This commit is contained in:
parent
471505e5d8
commit
31cc2e9a7a
|
@ -623,7 +623,7 @@ or it is followed by line end.")
|
|||
(defvar plantuml-indent-regexp-newif-end "^\s*\\(endif\\|elseif\\|else\\)\s*.*$")
|
||||
(defvar plantuml-indent-regexp-loop-end "^\s*\\(repeat\s*while\\|endwhile\\)\s*.*$")
|
||||
(defvar plantuml-indent-regexp-fork-end "^\s*\\(\\(fork\\|split\\)\s+again\\|end\s+\\(fork\\|split\\)\\)\s*$")
|
||||
(defvar plantuml-indent-regexp-case-end "^\s*\\(case\s-*([^)]*)\\|endswitch\\)\s*\\('.*\\)?$")
|
||||
(defvar plantuml-indent-regexp-case-end "^\s*\\(case\s-*(.*)\\|endswitch\\)\s*\\('.*\\)?$")
|
||||
(defvar plantuml-indent-regexp-macro-end "^\s*!enddefinelong\s*\\('.*\\)?$")
|
||||
(defvar plantuml-indent-regexp-user-control-end "^.*'.*\s*PLANTUML_MODE_INDENT_DECREASE\s*.*$")
|
||||
(defvar plantuml-indent-regexp-end (list plantuml-indent-regexp-block-end
|
||||
|
|
|
@ -384,7 +384,7 @@ stop
|
|||
|
||||
@enduml"))
|
||||
|
||||
(ert-deftest plantuml-test-indentation/activity-new/switch ()
|
||||
(ert-deftest plantuml-test-indentation/activity-new/switch-1 ()
|
||||
"Test correct indentation of plantuml activity-new complete example
|
||||
These code examples are taken from www.plantuml.com"
|
||||
(plantuml-test-indent-block
|
||||
|
@ -422,6 +422,44 @@ endswitch
|
|||
stop
|
||||
@enduml"))
|
||||
|
||||
(ert-deftest plantuml-test-indentation/activity-new/switch-2 ()
|
||||
"Test correct indentation of plantuml activity-new complete example
|
||||
These code examples are taken from www.plantuml.com"
|
||||
(plantuml-test-indent-block
|
||||
"@startuml
|
||||
start
|
||||
switch (test? (is it?))
|
||||
case ( condition (A) )
|
||||
:Text 1;
|
||||
case ( condition B (we do not care whether parentheses match or not)
|
||||
:Text 2;
|
||||
case ( condition C )))
|
||||
:Text 3;
|
||||
case ( condition D )
|
||||
:Text 4;
|
||||
case ( condition E )
|
||||
:Text 5;
|
||||
endswitch
|
||||
stop
|
||||
@enduml"
|
||||
|
||||
"@startuml
|
||||
start
|
||||
switch (test? (is it?))
|
||||
case ( condition (A) )
|
||||
:Text 1;
|
||||
case ( condition B (we do not care whether parentheses match or not)
|
||||
:Text 2;
|
||||
case ( condition C )))
|
||||
:Text 3;
|
||||
case ( condition D )
|
||||
:Text 4;
|
||||
case ( condition E )
|
||||
:Text 5;
|
||||
endswitch
|
||||
stop
|
||||
@enduml"))
|
||||
|
||||
(provide 'plantuml-indentation-activity-new-test)
|
||||
|
||||
;;; plantuml-indentation-activity-old-test.el ends here
|
||||
|
|
Loading…
Reference in New Issue