From f678b18a19e3c8050acfde90523b1542e4537053 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 16 May 2013 20:36:33 -0400 Subject: [PATCH] * lisp/progmodes/f90.el (f90-keywords-re, f90-keywords-level-3-re) (f90-hpf-keywords-re, f90-constants-re): Use \\_< rather than regexp-opt's `words'. --- lisp/ChangeLog | 6 ++ lisp/progmodes/f90.el | 200 ++++++++++++++++++++++-------------------- 2 files changed, 112 insertions(+), 94 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 84e1119bc6..78eefc8650 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-05-17 Stefan Monnier + + * progmodes/f90.el (f90-keywords-re, f90-keywords-level-3-re) + (f90-hpf-keywords-re, f90-constants-re): Use \\_< rather than + regexp-opt's `words'. + 2013-05-16 Leo Liu * emacs-lisp/smie.el (smie-matching-block-highlight): New face. diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index d7d0c10945..9bde2900a6 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -319,51 +319,57 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil." ;; User options end here. (defconst f90-keywords-re - (regexp-opt '("allocatable" "allocate" "assign" "assignment" "backspace" - "block" "call" "case" "character" "close" "common" "complex" - "contains" "continue" "cycle" "data" "deallocate" - "dimension" "do" "double" "else" "elseif" "elsewhere" "end" - "enddo" "endfile" "endif" "entry" "equivalence" "exit" - "external" "forall" "format" "function" "goto" "if" - "implicit" "include" "inquire" "integer" "intent" - "interface" "intrinsic" "logical" "module" "namelist" "none" - "nullify" "only" "open" "operator" "optional" "parameter" - "pause" "pointer" "precision" "print" "private" "procedure" - "program" "public" "read" "real" "recursive" "result" "return" - "rewind" "save" "select" "sequence" "stop" "subroutine" - "target" "then" "type" "use" "where" "while" "write" - ;; F95 keywords. - "elemental" "pure" - ;; F2003 - "abstract" "associate" "asynchronous" "bind" "class" - "deferred" "enum" "enumerator" "extends" "extends_type_of" - "final" "generic" "import" "non_intrinsic" "non_overridable" - "nopass" "pass" "protected" "same_type_as" "value" "volatile" - ;; F2008. - "contiguous" "submodule" "concurrent" "codimension" - "sync all" "sync memory" "critical" "image_index" - ) 'words) + (concat + "\\_<" + (regexp-opt '("allocatable" "allocate" "assign" "assignment" "backspace" + "block" "call" "case" "character" "close" "common" "complex" + "contains" "continue" "cycle" "data" "deallocate" + "dimension" "do" "double" "else" "elseif" "elsewhere" "end" + "enddo" "endfile" "endif" "entry" "equivalence" "exit" + "external" "forall" "format" "function" "goto" "if" + "implicit" "include" "inquire" "integer" "intent" + "interface" "intrinsic" "logical" "module" "namelist" "none" + "nullify" "only" "open" "operator" "optional" "parameter" + "pause" "pointer" "precision" "print" "private" "procedure" + "program" "public" "read" "real" "recursive" "result" "return" + "rewind" "save" "select" "sequence" "stop" "subroutine" + "target" "then" "type" "use" "where" "while" "write" + ;; F95 keywords. + "elemental" "pure" + ;; F2003 + "abstract" "associate" "asynchronous" "bind" "class" + "deferred" "enum" "enumerator" "extends" "extends_type_of" + "final" "generic" "import" "non_intrinsic" "non_overridable" + "nopass" "pass" "protected" "same_type_as" "value" "volatile" + ;; F2008. + "contiguous" "submodule" "concurrent" "codimension" + "sync all" "sync memory" "critical" "image_index" + )) + "\\_>") "Regexp used by the function `f90-change-keywords'.") (defconst f90-keywords-level-3-re - (regexp-opt - '("allocatable" "allocate" "assign" "assignment" "backspace" - "close" "deallocate" "dimension" "endfile" "entry" "equivalence" - "external" "inquire" "intent" "intrinsic" "nullify" "only" "open" - ;; FIXME operator and assignment should be F2003 procedures? - "operator" "optional" "parameter" "pause" "pointer" "print" "private" - "public" "read" "recursive" "result" "rewind" "save" "select" - "sequence" "target" "write" - ;; F95 keywords. - "elemental" "pure" - ;; F2003. asynchronous separate. - "abstract" "deferred" "import" "final" "non_intrinsic" "non_overridable" - "nopass" "pass" "protected" "value" "volatile" - ;; F2008. - ;; "concurrent" is only in the sense of "do [,] concurrent", but given - ;; the [,] it's simpler to just do every instance (cf "do while"). - "contiguous" "concurrent" "codimension" "sync all" "sync memory" - ) 'words) + (concat + "\\_<" + (regexp-opt + '("allocatable" "allocate" "assign" "assignment" "backspace" + "close" "deallocate" "dimension" "endfile" "entry" "equivalence" + "external" "inquire" "intent" "intrinsic" "nullify" "only" "open" + ;; FIXME operator and assignment should be F2003 procedures? + "operator" "optional" "parameter" "pause" "pointer" "print" "private" + "public" "read" "recursive" "result" "rewind" "save" "select" + "sequence" "target" "write" + ;; F95 keywords. + "elemental" "pure" + ;; F2003. asynchronous separate. + "abstract" "deferred" "import" "final" "non_intrinsic" "non_overridable" + "nopass" "pass" "protected" "value" "volatile" + ;; F2008. + ;; "concurrent" is only in the sense of "do [,] concurrent", but given + ;; the [,] it's simpler to just do every instance (cf "do while"). + "contiguous" "concurrent" "codimension" "sync all" "sync memory" + )) + "\\_>") "Keyword-regexp for font-lock level >= 3.") (defconst f90-procedures-re @@ -428,61 +434,67 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil." "Regexp matching intrinsic operators.") (defconst f90-hpf-keywords-re - (regexp-opt - ;; Intrinsic procedures. - '("all_prefix" "all_scatter" "all_suffix" "any_prefix" - "any_scatter" "any_suffix" "copy_prefix" "copy_scatter" - "copy_suffix" "count_prefix" "count_scatter" "count_suffix" - "grade_down" "grade_up" - "hpf_alignment" "hpf_distribution" "hpf_template" "iall" "iall_prefix" - "iall_scatter" "iall_suffix" "iany" "iany_prefix" "iany_scatter" - "iany_suffix" "ilen" "iparity" "iparity_prefix" - "iparity_scatter" "iparity_suffix" "leadz" "maxval_prefix" - "maxval_scatter" "maxval_suffix" "minval_prefix" "minval_scatter" - "minval_suffix" "number_of_processors" "parity" - "parity_prefix" "parity_scatter" "parity_suffix" "popcnt" "poppar" - "processors_shape" "product_prefix" "product_scatter" - "product_suffix" "sum_prefix" "sum_scatter" "sum_suffix" - ;; Directives. - "align" "distribute" "dynamic" "independent" "inherit" "processors" - "realign" "redistribute" "template" - ;; Keywords. - "block" "cyclic" "extrinsic" "new" "onto" "pure" "with") 'words) + (concat + "\\_<" + (regexp-opt + ;; Intrinsic procedures. + '("all_prefix" "all_scatter" "all_suffix" "any_prefix" + "any_scatter" "any_suffix" "copy_prefix" "copy_scatter" + "copy_suffix" "count_prefix" "count_scatter" "count_suffix" + "grade_down" "grade_up" + "hpf_alignment" "hpf_distribution" "hpf_template" "iall" "iall_prefix" + "iall_scatter" "iall_suffix" "iany" "iany_prefix" "iany_scatter" + "iany_suffix" "ilen" "iparity" "iparity_prefix" + "iparity_scatter" "iparity_suffix" "leadz" "maxval_prefix" + "maxval_scatter" "maxval_suffix" "minval_prefix" "minval_scatter" + "minval_suffix" "number_of_processors" "parity" + "parity_prefix" "parity_scatter" "parity_suffix" "popcnt" "poppar" + "processors_shape" "product_prefix" "product_scatter" + "product_suffix" "sum_prefix" "sum_scatter" "sum_suffix" + ;; Directives. + "align" "distribute" "dynamic" "independent" "inherit" "processors" + "realign" "redistribute" "template" + ;; Keywords. + "block" "cyclic" "extrinsic" "new" "onto" "pure" "with")) + "\\_>") "Regexp for all HPF keywords, procedures and directives.") (defconst f90-constants-re - (regexp-opt '( ;; F2003 iso_fortran_env constants. - "iso_fortran_env" - "input_unit" "output_unit" "error_unit" - "iostat_end" "iostat_eor" - "numeric_storage_size" "character_storage_size" - "file_storage_size" - ;; F2003 iso_c_binding constants. - "iso_c_binding" - "c_int" "c_short" "c_long" "c_long_long" "c_signed_char" - "c_size_t" - "c_int8_t" "c_int16_t" "c_int32_t" "c_int64_t" - "c_int_least8_t" "c_int_least16_t" "c_int_least32_t" - "c_int_least64_t" - "c_int_fast8_t" "c_int_fast16_t" "c_int_fast32_t" - "c_int_fast64_t" - "c_intmax_t" "c_intptr_t" - "c_float" "c_double" "c_long_double" - "c_float_complex" "c_double_complex" "c_long_double_complex" - "c_bool" "c_char" - "c_null_char" "c_alert" "c_backspace" "c_form_feed" - "c_new_line" "c_carriage_return" "c_horizontal_tab" - "c_vertical_tab" - "c_ptr" "c_funptr" "c_null_ptr" "c_null_funptr" - "ieee_exceptions" - "ieee_arithmetic" - "ieee_features" - ;; F2008 iso_fortran_env constants. - "character_kinds" "int8" "int16" "int32" "int64" - "integer_kinds" "iostat_inquire_internal_unit" - "logical_kinds" "real_kinds" "real32" "real64" "real128" - "lock_type" "atomic_int_kind" "atomic_logical_kind" - ) 'words) + (concat + "\\_<" + (regexp-opt '( ;; F2003 iso_fortran_env constants. + "iso_fortran_env" + "input_unit" "output_unit" "error_unit" + "iostat_end" "iostat_eor" + "numeric_storage_size" "character_storage_size" + "file_storage_size" + ;; F2003 iso_c_binding constants. + "iso_c_binding" + "c_int" "c_short" "c_long" "c_long_long" "c_signed_char" + "c_size_t" + "c_int8_t" "c_int16_t" "c_int32_t" "c_int64_t" + "c_int_least8_t" "c_int_least16_t" "c_int_least32_t" + "c_int_least64_t" + "c_int_fast8_t" "c_int_fast16_t" "c_int_fast32_t" + "c_int_fast64_t" + "c_intmax_t" "c_intptr_t" + "c_float" "c_double" "c_long_double" + "c_float_complex" "c_double_complex" "c_long_double_complex" + "c_bool" "c_char" + "c_null_char" "c_alert" "c_backspace" "c_form_feed" + "c_new_line" "c_carriage_return" "c_horizontal_tab" + "c_vertical_tab" + "c_ptr" "c_funptr" "c_null_ptr" "c_null_funptr" + "ieee_exceptions" + "ieee_arithmetic" + "ieee_features" + ;; F2008 iso_fortran_env constants. + "character_kinds" "int8" "int16" "int32" "int64" + "integer_kinds" "iostat_inquire_internal_unit" + "logical_kinds" "real_kinds" "real32" "real64" "real128" + "lock_type" "atomic_int_kind" "atomic_logical_kind" + )) + "\\_>") "Regexp for Fortran intrinsic constants.") ;; cf f90-looking-at-type-like. -- 2.20.1