From 1d5963cc63979c4a19b5de3b9b537c1b3b61dda3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 8 May 2013 12:27:53 -0400 Subject: * lisp/progmodes/f90.el (f90-mode-syntax-table): Use symbol syntax for "_". Change all regexps to use things like \_< and \_>. * lisp/progmodes/ada-mode.el (ada-mode-abbrev-table): Consolidate declaration. (ada-mode-syntax-table, ada-mode-symbol-syntax-table): Initialize in the declaration. (ada-create-syntax-table): Remove. (ada-capitalize-word): Don't mess with the syntax of "_" since it already has the right syntax nowadays. (ada-goto-next-word): Don't change the syntax of "_". * lisp/progmodes/autoconf.el (autoconf-definition-regexp) (autoconf-font-lock-keywords, autoconf-current-defun-function): Handle a _ with symbol syntax. (autoconf-mode): Don't change the syntax-table for imenu and font-lock. * lisp/progmodes/vera-mode.el (vera-underscore-is-part-of-word): * lisp/progmodes/prolog.el (prolog-underscore-wordchar-flag) (prolog-char-quote-workaround): * lisp/progmodes/cperl-mode.el (cperl-under-as-char): * lisp/progmodes/vhdl-mode.el (vhdl-underscore-is-part-of-word): Mark as obsolete. (vhdl-mode-syntax-table, vhdl-mode-ext-syntax-table): Initialize in their declaration. (vhdl-mode-syntax-table-init): Remove. * lisp/progmodes/ld-script.el (ld-script-mode-syntax-table): Use symbol syntax for "_". (ld-script-font-lock-keywords): Change regexps to use things like \_< and \_>. * lisp/progmodes/m4-mode.el (m4-mode-syntax-table): Add comment on last change. * lisp/font-lock.el (lisp-font-lock-keywords-2): Don't highlight obsolete with-wrapper-hook. * lisp/mh-e/mh-comp.el (mh-regexp-in-field-p): Minor simplification. --- lisp/progmodes/f90.el | 246 +++++++++++++++++++++++++------------------------- 1 file changed, 122 insertions(+), 124 deletions(-) (limited to 'lisp/progmodes/f90.el') diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 924f9d8ac3d..3471bbbe384 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -367,7 +367,7 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil." "Keyword-regexp for font-lock level >= 3.") (defconst f90-procedures-re - (concat "\\<" + (concat "\\_<" (regexp-opt '("abs" "achar" "acos" "adjustl" "adjustr" "aimag" "aint" "all" "allocated" "anint" "any" "asin" "associated" @@ -491,16 +491,16 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil." Set the match data so that subexpression 1,2 are the TYPE, and type-name parts, respectively." (let (found l) - (while (and (re-search-forward "\\<\\(\\(?:end[ \t]*\\)?type\\)\\>[ \t]*" + (while (and (re-search-forward "\\_<\\(\\(?:end[ \t]*\\)?type\\)\\_>[ \t]*" limit t) (not (setq found (progn (setq l (match-data)) - (unless (looking-at "\\(is\\>\\|(\\)") - (when (if (looking-at "\\(\\sw+\\)") + (unless (looking-at "\\(is\\_>\\|(\\)") + (when (if (looking-at "\\(\\(?:\\sw\\|\\s_\\)+\\)") (goto-char (match-end 0)) (re-search-forward - "[ \t]*::[ \t]*\\(\\sw+\\)" + "[ \t]*::[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)" (line-end-position) t)) ;; 0 is wrong, but we don't use it. (set-match-data @@ -512,33 +512,33 @@ type-name parts, respectively." (defvar f90-font-lock-keywords-1 (list ;; Special highlighting of "module procedure". - '("\\<\\(module[ \t]*procedure\\)\\>\\([^()\n]*::\\)?[ \t]*\\([^&!\n]*\\)" + '("\\_<\\(module[ \t]*procedure\\)\\_>\\([^()\n]*::\\)?[ \t]*\\([^&!\n]*\\)" (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) ;; Highlight definition of derived type. -;;; '("\\<\\(\\(?:end[ \t]*\\)?type\\)\\>\\([^()\n]*::\\)?[ \t]*\\(\\sw+\\)" +;;; '("\\_<\\(\\(?:end[ \t]*\\)?type\\)\\_>\\([^()\n]*::\\)?[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)" ;;; (1 font-lock-keyword-face) (3 font-lock-function-name-face)) '(f90-typedef-matcher (1 font-lock-keyword-face) (2 font-lock-function-name-face)) ;; F2003. Prevent operators being highlighted as functions. - '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\ + '("\\_<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\ read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t)) ;; Other functions and declarations. Named interfaces = F2003. ;; F2008: end submodule submodule_name. - '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\ + '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\ function\\|associate\\|subroutine\\|interface\\)\\|use\\|call\\)\ -\\>[ \t]*\\(\\sw+\\)?" +\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) ;; F2008: submodule (parent_name) submodule_name. - '("\\<\\(submodule\\)\\>[ \t]*([^)\n]+)[ \t]*\\(\\sw+\\)?" + '("\\_<\\(submodule\\)\\_>[ \t]*([^)\n]+)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)) ;; F2003. - '("\\<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\ -\\(\\sw+\\)" + '("\\_<\\(use\\)[ \t]*,[ \t]*\\(\\(?:non_\\)?intrinsic\\)[ \t]*::[ \t]*\ +\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 font-lock-keyword-face) (2 font-lock-keyword-face) (3 font-lock-function-name-face)) - "\\<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\)\\>" + "\\_<\\(\\(end[ \t]*\\)?block[ \t]*data\\|contains\\)\\_>" ;; "abstract interface" is F2003. - '("\\" (0 font-lock-keyword-face t))) + '("\\_" (0 font-lock-keyword-face t))) "This does fairly subdued highlighting of comments and function calls.") ;; NB not explicitly handling this, yet it seems to work. @@ -550,7 +550,7 @@ and variable-name parts, respectively." ;; Matcher functions must return nil only when there are no more ;; matches within the search range. (let (found l) - (while (and (re-search-forward "\\<\\(type\\|class\\)[ \t]*(" limit t) + (while (and (re-search-forward "\\_<\\(type\\|class\\)[ \t]*(" limit t) (not (setq found (condition-case nil @@ -565,7 +565,7 @@ and variable-name parts, respectively." (when (re-search-forward ;; type (foo) bar, qux - (if (looking-at "\\sw+") + (if (looking-at "\\(?:\\sw\\|\\s_\\)+") "\\([^&!\n]+\\)" ;; type (foo), stuff :: bar, qux "::[ \t]*\\([^&!\n]+\\)") @@ -608,53 +608,53 @@ enumerator\\|generic\\|procedure\\|logical\\|double[ \t]*precision\\)\ ;; integer( kind=1 ) function foo() ;; thanks to the happy accident described above. ;; Not anchored, so don't need to worry about "pure" etc. - '("\\<\\(\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|\ + '("\\_<\\(\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|\ logical\\|double[ \t]*precision\\|\ -\\(?:type\\|class\\)[ \t]*([ \t]*\\sw+[ \t]*)\\)[ \t]*\\)\ -\\(function\\)\\>[ \t]*\\(\\sw+\\)[ \t]*\\(([^&!\n]*)\\)" +\\(?:type\\|class\\)[ \t]*([ \t]*\\(?:\\sw\\|\\s_\\)+[ \t]*)\\)[ \t]*\\)\ +\\(function\\)\\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*\\(([^&!\n]*)\\)" (1 font-lock-type-face t) (4 font-lock-keyword-face t) (5 font-lock-function-name-face t) (6 'default t)) ;; enum (F2003; must be followed by ", bind(C)"). - '("\\<\\(enum\\)[ \t]*," (1 font-lock-keyword-face)) + '("\\_<\\(enum\\)[ \t]*," (1 font-lock-keyword-face)) ;; end do, enum (F2003), if, select, where, and forall constructs. ;; block, critical (F2008). ;; Note that "block data" may get somewhat mixed up with F2008 blocks, ;; but since the former is obsolete I'm not going to worry about it. - '("\\<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\|\ -block\\|critical\\)\\)\\>\ -\\([ \t]+\\(\\sw+\\)\\)?" + '("\\_<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\|\ +block\\|critical\\)\\)\\_>\ +\\([ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\)?" (1 font-lock-keyword-face) (3 font-lock-constant-face nil t)) - '("^[ \t0-9]*\\(\\(\\sw+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\ + '("^[ \t0-9]*\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\ do\\([ \t]*while\\)?\\|select[ \t]*\\(?:case\\|type\\)\\|where\\|\ -forall\\|block\\|critical\\)\\)\\>" +forall\\|block\\|critical\\)\\)\\_>" (2 font-lock-constant-face nil t) (3 font-lock-keyword-face)) ;; Implicit declaration. - '("\\<\\(implicit\\)[ \t]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\ + '("\\_<\\(implicit\\)[ \t]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\ \\|enumerator\\|procedure\\|\ -logical\\|double[ \t]*precision\\|type[ \t]*(\\sw+)\\|none\\)[ \t]*" +logical\\|double[ \t]*precision\\|type[ \t]*(\\(?:\\sw\\|\\s_\\)+)\\|none\\)[ \t]*" (1 font-lock-keyword-face) (2 font-lock-type-face)) - '("\\<\\(namelist\\|common\\)[ \t]*\/\\(\\sw+\\)?\/" + '("\\_<\\(namelist\\|common\\)[ \t]*\/\\(\\(?:\\sw\\|\\s_\\)+\\)?\/" (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) - "\\" + "\\_" '("\\(&\\)[ \t]*\\(!\\|$\\)" (1 font-lock-keyword-face)) - "\\<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\>" - '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)?\\>" + "\\_<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\_>" + '("\\_<\\(exit\\|cycle\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?\\_>" (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) - '("\\<\\(case\\)[ \t]*\\(default\\|(\\)" . 1) + '("\\_<\\(case\\)[ \t]*\\(default\\|(\\)" . 1) ;; F2003 "class default". - '("\\<\\(class\\)[ \t]*default" . 1) + '("\\_<\\(class\\)[ \t]*default" . 1) ;; F2003 "type is" in a "select type" block. - '("\\<\\(\\(type\\|class\\)[ \t]*is\\)[ \t]*(" (1 font-lock-keyword-face t)) - '("\\<\\(do\\|go[ \t]*to\\)\\>[ \t]*\\([0-9]+\\)" + '("\\_<\\(\\(type\\|class\\)[ \t]*is\\)[ \t]*(" (1 font-lock-keyword-face t)) + '("\\_<\\(do\\|go[ \t]*to\\)\\_>[ \t]*\\([0-9]+\\)" (1 font-lock-keyword-face) (2 font-lock-constant-face)) ;; Line numbers (lines whose first character after number is letter). '("^[ \t]*\\([0-9]+\\)[ \t]*[a-z]+" (1 font-lock-constant-face t)) ;; Override eg for "#include". - '("^#[ \t]*\\w+" (0 font-lock-preprocessor-face t) - ("\\" nil nil (0 font-lock-preprocessor-face))) + '("^#[ \t]*\\(?:\\sw\\|\\s_\\)+" (0 font-lock-preprocessor-face t) + ("\\_" nil nil (0 font-lock-preprocessor-face))) '("^#" ("\\(&&\\|||\\)" nil nil (0 font-lock-constant-face t))) - '("^#[ \t]*define[ \t]+\\(\\w+\\)(" (1 font-lock-function-name-face)) - '("^#[ \t]*define[ \t]+\\(\\w+\\)" (1 font-lock-variable-name-face)) + '("^#[ \t]*define[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)(" (1 font-lock-function-name-face)) + '("^#[ \t]*define[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 font-lock-variable-name-face)) '("^#[ \t]*include[ \t]+\\(<.+>\\)" (1 font-lock-string-face)))) "Highlights declarations, do-loops and other constructs.") @@ -666,9 +666,9 @@ logical\\|double[ \t]*precision\\|type[ \t]*(\\sw+)\\|none\\)[ \t]*" ;; FIXME why isn't this font-lock-builtin-face, which ;; otherwise we hardly use, as in fortran.el? (list f90-procedures-re '(1 font-lock-keyword-face keep)) - "\\" ; avoid overwriting real defs + "\\_" ; avoid overwriting real defs ;; As an attribute, but not as an optional argument. - '("\\<\\(asynchronous\\)[ \t]*[^=]" . 1))) + '("\\_<\\(asynchronous\\)[ \t]*[^=]" . 1))) "Highlights all F90 keywords and intrinsic procedures.") (defvar f90-font-lock-keywords-4 @@ -687,8 +687,7 @@ Can be overridden by the value of `font-lock-maximum-decoration'.") (let ((table (make-syntax-table))) (modify-syntax-entry ?\! "<" table) ; begin comment (modify-syntax-entry ?\n ">" table) ; end comment - ;; FIXME: This goes against the convention: it should be "_". - (modify-syntax-entry ?_ "w" table) ; underscore in names + (modify-syntax-entry ?_ "_" table) ; underscore in names (modify-syntax-entry ?\' "\"" table) ; string quote (modify-syntax-entry ?\" "\"" table) ; string quote ;; FIXME: We used to set ` to word syntax for the benefit of abbrevs, but @@ -850,7 +849,7 @@ Can be overridden by the value of `font-lock-maximum-decoration'.") "enum" "associate" ;; F2008. "submodule" "block" "critical")) - "\\)\\>") + "\\)\\_>") "Regexp potentially indicating a \"block\" of F90 code.") (defconst f90-program-block-re @@ -866,15 +865,15 @@ Can be overridden by the value of `font-lock-maximum-decoration'.") (defconst f90-end-if-re (concat "end[ \t]*" (regexp-opt '("if" "select" "where" "forall") 'paren) - "\\>") + "\\_>") "Regexp matching the end of an IF, SELECT, WHERE, FORALL block.") (defconst f90-end-type-re - "end[ \t]*\\(type\\|enum\\|interface\\|block[ \t]*data\\)\\>" + "end[ \t]*\\(type\\|enum\\|interface\\|block[ \t]*data\\)\\_>" "Regexp matching the end of a TYPE, ENUM, INTERFACE, BLOCK DATA section.") (defconst f90-end-associate-re - "end[ \t]*associate\\>" + "end[ \t]*associate\\_>" "Regexp matching the end of an ASSOCIATE block.") ;; This is for a TYPE block, not a variable of derived TYPE. @@ -885,12 +884,12 @@ Can be overridden by the value of `font-lock-maximum-decoration'.") ;; type, stuff :: word ;; type, bind(c) :: word ;; NOT "type (" - "\\<\\(type\\)\\>\\(?:\\(?:[^()\n]*\\|\ -.*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\sw+\\)" + "\\_<\\(type\\)\\_>\\(?:\\(?:[^()\n]*\\|\ +.*,[ \t]*bind[ \t]*([ \t]*c[ \t]*)[ \t]*\\)::\\)?[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)" "Regexp matching the definition of a derived type.") (defconst f90-typeis-re - "\\<\\(class\\|type\\)[ \t]*is[ \t]*(" + "\\_<\\(class\\|type\\)[ \t]*is[ \t]*(" "Regexp matching a CLASS/TYPE IS statement.") (defconst f90-no-break-re @@ -909,12 +908,12 @@ allowed. This minor issue currently only affects \"(/\" and \"/)\".") ;; Hideshow support. (defconst f90-end-block-re - (concat "^[ \t0-9]*\\") + "\\_>") "Regexp matching the end of an F90 \"block\", from the line start. Used in the F90 entry in `hs-special-modes-alist'.") @@ -924,11 +923,11 @@ Used in the F90 entry in `hs-special-modes-alist'.") (concat "^[ \t0-9]*" ; statement number "\\(\\(" - "\\(\\sw+[ \t]*:[ \t]*\\)?" ; structure label + "\\(\\(?:\\sw\\|\\s_\\)+[ \t]*:[ \t]*\\)?" ; structure label "\\(do\\|select[ \t]*\\(case\\|type\\)\\|" ;; See comments in fortran-start-block-re for the problems of IF. "if[ \t]*(\\(.*\\|" - ".*\n\\([^if]*\\([^i].\\|.[^f]\\|.\\>\\)\\)\\)\\\\)\\)\\)\\_\\|(\\)") - (or (looking-at "\\(\\sw+\\)") + (unless (looking-at "\\(is\\_>\\|(\\)") + (or (looking-at "\\(\\(?:\\sw\\|\\s_\\)+\\)") (re-search-forward - "[ \t]*::[ \t]*\\(\\sw+\\)" + "[ \t]*::[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)" (line-end-position) t)))))))) found)) @@ -978,36 +977,35 @@ Set subexpression 1 in the match-data to the name of the type." (not-n "[^n!\n\"\& \t]") (not-d "[^d!\n\"\& \t]") ;; (not-ib "[^i(!\n\"\& \t]") (not-s "[^s!\n\"\& \t]") ) - (list - '(nil "^[ \t0-9]*program[ \t]+\\(\\sw+\\)" 1) - '("Submodules" "^[ \t0-9]*submodule[ \t]*([^)\n]+)[ \t]*\ -\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1) - '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1) - (list "Types" 'f90-imenu-type-matcher 1) - ;; Does not handle: "type[, stuff] :: foo". -;;; (format "^[ \t0-9]*type[ \t]+\\(\\(%s\\|i%s\\|is\\sw\\)\\sw*\\)" -;;; not-ib not-s) -;;; 1) - ;; Can't get the subexpression numbers to match in the two branches. -;;; (format "^[ \t0-9]*type\\([ \t]*,.*\\(::\\)[ \t]*\\(\\sw+\\)\\|[ \t]+\\(\\(%s\\|i%s\\|is\\sw\\)\\sw*\\)\\)" not-ib not-s) -;;; 3) - (list - "Procedures" - (concat - "^[ \t0-9]*" - "\\(" - ;; At least three non-space characters before function/subroutine. - ;; Check that the last three non-space characters do not spell E N D. - "[^!\"\&\n]*\\(" - not-e good-char good-char "\\|" - good-char not-n good-char "\\|" - good-char good-char not-d "\\)" - "\\|" - ;; Less than three non-space characters before function/subroutine. - good-char "?" good-char "?" - "\\)" - "[ \t]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)") - 4))) + `((nil "^[ \t0-9]*program[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)" 1) + ("Submodules" "^[ \t0-9]*submodule[ \t]*([^)\n]+)[ \t]*\ +\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*\\(!\\|$\\)" 1) + ("Modules" "^[ \t0-9]*module[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*\\(!\\|$\\)" 1) + '("Types" f90-imenu-type-matcher 1) + ;; Does not handle: "type[, stuff] :: foo". + ;;(format "^[ \t0-9]*type[ \t]+\\(\\(%s\\|i%s\\|is\\(?:\\sw\\|\\s_\\)\\)\\(?:\\sw\\|\\s_\\)*\\)" + ;; not-ib not-s) + ;;1) + ;; Can't get the subexpression numbers to match in the two branches. + ;; FIXME: Now with \(?N:..\) we can get the numbers to match! + ;;(format "^[ \t0-9]*type\\([ \t]*,.*\\(::\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\|[ \t]+\\(\\(%s\\|i%s\\|is\\(?:\\sw\\|\\s_\\)\\)\\(?:\\sw\\|\\s_\\)*\\)\\)" not-ib not-s) + ;;3) + ("Procedures" + ,(concat + "^[ \t0-9]*" + "\\(" + ;; At least three non-space characters before function/subroutine. + ;; Check that the last three non-space characters do not spell E N D. + "[^!\"\&\n]*\\(" + not-e good-char good-char "\\|" + good-char not-n good-char "\\|" + good-char good-char not-d "\\)" + "\\|" + ;; Less than three non-space characters before function/subroutine. + good-char "?" good-char "?" + "\\)" + "[ \t]*\\(function\\|subroutine\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)") + 4))) "Value for `imenu-generic-expression' in F90 mode.") (defun f90-add-imenu-menu () @@ -1144,7 +1142,7 @@ Variables controlling indentation style and extra features: whether to blink the matching beginning (default 'blink). `f90-auto-keyword-case' Automatic change of case of keywords (default nil). - The possibilities are 'downcase-word, 'upcase-word, 'capitalize-word. + The possibilities are `downcase-word', `upcase-word', `capitalize-word'. `f90-leave-line-no' Do not left-justify line numbers (default nil). @@ -1256,13 +1254,13 @@ whitespace, if any." (defsubst f90-looking-at-do () "Return (\"do\" NAME) if a do statement starts after point. NAME is nil if the statement has no label." - (if (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\\(do\\)\\>") + (if (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\\(do\\)\\_>") (list (match-string 3) (match-string 2)))) (defsubst f90-looking-at-select-case () "Return (\"select\" NAME) if a select statement starts after point. NAME is nil if the statement has no label." - (if (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\ + (if (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\ \\(select\\)[ \t]*\\(case\\|type\\)[ \t]*(") (list (match-string 3) (match-string 2)))) @@ -1270,50 +1268,50 @@ NAME is nil if the statement has no label." "Return (\"if\" NAME) if an if () then statement starts after point. NAME is nil if the statement has no label." (save-excursion - (when (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\\(if\\)\\>") + (when (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\\(if\\)\\_>") (let ((struct (match-string 3)) (label (match-string 2)) (pos (scan-lists (point) 1 0))) (and pos (goto-char pos)) (skip-chars-forward " \t") - (if (or (looking-at "then\\>") + (if (or (looking-at "then\\_>") (when (f90-line-continued) (f90-next-statement) (skip-chars-forward " \t0-9&") - (looking-at "then\\>"))) + (looking-at "then\\_>"))) (list struct label)))))) ;; FIXME label? (defsubst f90-looking-at-associate () "Return (\"associate\") if an associate block starts after point." - (if (looking-at "\\<\\(associate\\)[ \t]*(") + (if (looking-at "\\_<\\(associate\\)[ \t]*(") (list (match-string 1)))) (defsubst f90-looking-at-critical () "Return (KIND NAME) if a critical or block block starts after point." - (if (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\\(critical\\|block\\)\\>") + (if (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\\(critical\\|block\\)\\_>") (let ((struct (match-string 3)) (label (match-string 2))) (if (or (not (string-equal "block" struct)) (save-excursion (skip-chars-forward " \t") - (not (looking-at "data\\>")))) + (not (looking-at "data\\_>")))) (list struct label))))) (defsubst f90-looking-at-end-critical () "Return non-nil if a critical or block block ends after point." - (if (looking-at "end[ \t]*\\(critical\\|block\\)\\>") + (if (looking-at "end[ \t]*\\(critical\\|block\\)\\_>") (or (not (string-equal "block" (match-string 1))) (save-excursion (skip-chars-forward " \t") - (not (looking-at "data\\>")))))) + (not (looking-at "data\\_>")))))) (defsubst f90-looking-at-where-or-forall () "Return (KIND NAME) if a where or forall block starts after point. NAME is nil if the statement has no label." (save-excursion - (when (looking-at "\\(\\(\\sw+\\)[ \t]*:\\)?[ \t]*\ -\\(where\\|forall\\)\\>") + (when (looking-at "\\(\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:\\)?[ \t]*\ +\\(where\\|forall\\)\\_>") (let ((struct (match-string 3)) (label (match-string 2)) (pos (scan-lists (point) 1 0))) @@ -1326,43 +1324,43 @@ NAME is nil if the statement has no label." NAME is non-nil only for type and certain interfaces." (cond ((save-excursion - (and (looking-at "\\[ \t]*") + (and (looking-at "\\_[ \t]*") (goto-char (match-end 0)) - (not (looking-at "\\(is\\>\\|(\\)")) - (or (looking-at "\\(\\sw+\\)") - (re-search-forward "[ \t]*::[ \t]*\\(\\sw+\\)" + (not (looking-at "\\(is\\_>\\|(\\)")) + (or (looking-at "\\(\\(?:\\sw\\|\\s_\\)+\\)") + (re-search-forward "[ \t]*::[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)" (line-end-position) t)))) (list "type" (match-string 1))) ;;; ((and (not (looking-at f90-typeis-re)) ;;; (looking-at f90-type-def-re)) ;;; (list (match-string 1) (match-string 2))) - ((looking-at "\\<\\(interface\\)\\>[ \t]*") + ((looking-at "\\_<\\(interface\\)\\_>[ \t]*") (list (match-string 1) (save-excursion (goto-char (match-end 0)) (if (or (looking-at "\\(operator\\|assignment\\|read\\|\ write\\)[ \t]*([^)\n]*)") - (looking-at "\\sw+")) + (looking-at "\\(?:\\sw\\|\\s_\\)+")) (match-string 0))))) - ((looking-at "\\(enum\\|block[ \t]*data\\)\\>") + ((looking-at "\\(enum\\|block[ \t]*data\\)\\_>") (list (match-string 1) nil)) - ((looking-at "abstract[ \t]*\\(interface\\)\\>") + ((looking-at "abstract[ \t]*\\(interface\\)\\_>") (list (match-string 1) nil)))) (defsubst f90-looking-at-program-block-start () "Return (KIND NAME) if a program block with name NAME starts after point." ;;;NAME is nil for an un-named main PROGRAM block." (cond - ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>") + ((looking-at "\\(program\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "module[ \t]*procedure\\>")) - (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>")) + ((and (not (looking-at "module[ \t]*procedure\\_>")) + (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")) (list (match-string 1) (match-string 2))) - ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ \t]*\\(\\sw+\\)\\>") + ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)")) (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\ -\\(\\sw+\\)")) +\\(\\(?:\\sw\\|\\s_\\)+\\)")) (list (match-string 1) (match-string 2))))) ;; Following will match an un-named main program block; however ;; one needs to check if there is an actual PROGRAM statement after @@ -1378,7 +1376,7 @@ write\\)[ \t]*([^)\n]*)") \\(?:assignment\\|operator\\|read\\|write\\)[ \t]*([^)\n]*)\\)") (list (match-string 1) (match-string 2))) ((looking-at (concat "end[ \t]*" f90-blocks-re - "?\\([ \t]+\\(\\sw+\\)\\)?\\>")) + "?\\([ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\)?\\_>")) (list (match-string 1) (match-string 3))))) (defsubst f90-comment-indent () @@ -1435,10 +1433,10 @@ if all else fails." (not (or (looking-at "end") (looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\ \\|select[ \t]*\\(case\\|type\\)\\|case\\|where\\|forall\\|\ -block\\|critical\\)\\>") +block\\|critical\\)\\_>") (looking-at "\\(program\\|\\(?:sub\\)?module\\|\ -\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\>") - (looking-at "\\(contains\\|\\sw+[ \t]*:\\)") +\\(?:abstract[ \t]*\\)?interface\\|block[ \t]*data\\)\\_>") + (looking-at "\\(contains\\|\\(?:\\sw\\|\\s_\\)+[ \t]*:\\)") (looking-at f90-type-def-re) (re-search-forward "\\(function\\|subroutine\\)" (line-end-position) t))))) @@ -1504,7 +1502,7 @@ Does not check type and subprogram indentation." (setq icol (- icol f90-associate-indent))) ((f90-looking-at-end-critical) (setq icol (- icol f90-critical-indent))) - ((looking-at "end[ \t]*do\\>") + ((looking-at "end[ \t]*do\\_>") (setq icol (- icol f90-do-indent)))) (end-of-line)) icol))) @@ -1571,7 +1569,7 @@ Does not check type and subprogram indentation." (cond ((or (looking-at f90-else-like-re) (looking-at f90-end-if-re)) (setq icol (- icol f90-if-indent))) - ((looking-at "end[ \t]*do\\>") + ((looking-at "end[ \t]*do\\_>") (setq icol (- icol f90-do-indent))) ((looking-at f90-end-type-re) (setq icol (- icol f90-type-indent))) @@ -1692,7 +1690,7 @@ Interactively, pushes mark before moving point." (setq start-list (cons start-this start-list) ; not add-to-list! count (1+ count))) ((looking-at (concat "end[ \t]*" f90-blocks-re - "[ \t]*\\(\\sw+\\)?")) + "[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?")) (setq end-type (match-string 1) end-label (match-string 2) count (1- count)) @@ -1737,7 +1735,7 @@ Interactively, pushes mark before moving point." (skip-chars-forward " \t0-9") (cond ((or (f90-in-string) (f90-in-comment))) ((looking-at (concat "end[ \t]*" f90-blocks-re - "[ \t]*\\(\\sw+\\)?")) + "[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?")) (setq end-list (cons (list (match-string 1) (match-string 2)) end-list) count (1+ count))) @@ -1983,7 +1981,7 @@ If run in the middle of a line, the line is not broken." (car end-struct) (cadr end-struct)))) (setq ind-b (cond ((looking-at f90-end-if-re) f90-if-indent) - ((looking-at "end[ \t]*do\\>") f90-do-indent) + ((looking-at "end[ \t]*do\\_>") f90-do-indent) ((looking-at f90-end-type-re) f90-type-indent) ((looking-at f90-end-associate-re) f90-associate-indent) -- cgit v1.2.1