diff options
author | Brad King <brad.king@kitware.com> | 2003-06-19 15:11:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2003-06-19 15:11:54 (GMT) |
commit | a7cde5c0052a5ebb0b44b0f9d2baa6335c4fe95c (patch) | |
tree | fe475e331dc717fcf583c4680dc8727bf65fb013 /Docs | |
parent | cc3b1932bea4cd919cdf2e52b18ec5fbc28850d2 (diff) | |
download | CMake-a7cde5c0052a5ebb0b44b0f9d2baa6335c4fe95c.zip CMake-a7cde5c0052a5ebb0b44b0f9d2baa6335c4fe95c.tar.gz CMake-a7cde5c0052a5ebb0b44b0f9d2baa6335c4fe95c.tar.bz2 |
ENH: Wrote more robust regular expressions for indenting.
Diffstat (limited to 'Docs')
-rw-r--r-- | Docs/cmake-mode.el | 14 |
1 files 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\\)") |