From a7cde5c0052a5ebb0b44b0f9d2baa6335c4fe95c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Jun 2003 11:11:54 -0400 Subject: ENH: Wrote more robust regular expressions for indenting. --- Docs/cmake-mode.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el index cbb12c4..9571ac5 100644 --- a/Docs/cmake-mode.el +++ b/Docs/cmake-mode.el @@ -12,9 +12,19 @@ (defvar cmake-tab-width 2) ; Regular expressions used by line indentation function. +(defconst cmake-regex-quoted "\"\\([^\n\"\\\\]\\|\\\\.\\)*\"") +(defconst cmake-regex-unquoted "\\([^\n \t()\\\\]\\|\\\\.\\)+") +(defconst cmake-regex-arguments (concat "\\(" cmake-regex-quoted + "\\|" cmake-regex-unquoted + "\\|[ \t]\\)*")) +(defconst cmake-regex-comment "\\(#[^\n]*\\)?") +(defconst cmake-regex-identifier "[A-Za-z][A-Za-z0-9_]*") (defconst cmake-indent-blank-regex "^[ \t]*$") -(defconst cmake-indent-open-regex "^[^()\n]*([^()\n]*\\(#[^\n]*\\)?\n") -(defconst cmake-indent-close-regex "^[^()\n]*)[ \t]*\\(#[^\n]*\\)?\n") +(defconst cmake-indent-open-regex (concat "^[ \t]*" cmake-regex-identifier + "[ \t]*(" cmake-regex-arguments + cmake-indent-comment-regex "\n")) +(defconst cmake-indent-close-regex (concat "^" cmake-regex-arguments + ")[ \t]*" cmake-indent-comment-regex "\n")) (defconst cmake-indent-begin-regex "^[ \t]*\\(IF\\|MACRO\\|FOREACH\\|ELSE\\)") (defconst cmake-indent-end-regex "^[ \t]*\\(ENDIF\\|ENDFOREACH\\|ENDMACRO\\|ELSE\\)") -- cgit v0.12