Show
Ignore:
Timestamp:
04/18/08 08:49:46 (6 months ago)
Author:
pmoura
Message:

Corrected syntax coloring bugs with variables starting with underscores (including anonymous variables) and with atoms containing an underscore in the Emacs text editor. Thanks to Joerg Schuster for the bug report.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wenv/emacs/logtalk.el

    r3952 r4210  
    55;; Author: Paulo Moura 
    66;; Creation date: November 15, 2003 
    7 ;; Last modification date: December 6, 2007 
    8 ;; Version: 1.2 
     7;; Last modification date: April 18, 2008 
     8;; Version: 1.3 
    99 
    1010;; Installation: 
     
    2828;; setup  
    2929 
    30 (defvar logtalk-mode-version "1.2" 
     30(defvar logtalk-mode-version "1.3" 
    3131    "Logtalk mode version number") 
    3232 
     
    5151    (let ((logtalk-mode-syntax-table (make-syntax-table))) 
    5252        (modify-syntax-entry ?_ "w" logtalk-mode-syntax-table) 
    53         (modify-syntax-entry ?_ "_" logtalk-mode-syntax-table) 
    5453        (modify-syntax-entry ?/ ". 14b" logtalk-mode-syntax-table) 
    5554        (modify-syntax-entry ?* ". 23b" logtalk-mode-syntax-table) 
     
    104103        ("\\(:- \\)\\(alias\\|calls\\|d\\(?:iscontiguous\\|ynamic\\)\\|e\\(?:ncoding\\|xport\\)\\|in\\(?:fo\\|itialization\\)\\|m\\(?:\\(?:eta_predicat\\|od\\)e\\)\\|op\\|use\\(?:s\\|_module\\)\\|synchronized\\)\\([(]\\)" 2 'logtalk-directive-face) 
    105104        ("\\(:- \\)\\(dynamic\\|synchronized\\|threaded\\)\\([\.]\\)" 2 'logtalk-directive-face) 
    106         ("\\(\\(?:complement\\|extend\\|i\\(?:mp\\(?:\\(?:lemen\\|or\\)t\\)\\|nstantiate\\)\\|specialize\\)s\\)\\([(]\\)" 1 'logtalk-directive-face) 
     105        ("\\<\\(\\(?:complement\\|extend\\|i\\(?:mp\\(?:\\(?:lemen\\|or\\)t\\)\\|nstantiate\\)\\|specialize\\)s\\)\\([(]\\)" 1 'logtalk-directive-face) 
    107106    )) 
    108107 
     
    110109(setq logtalk-font-lock-built-in-methods 
    111110    '( 
    112         ("\\(parameter\\|se\\(?:lf\\|nder\\)\\|this\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
    113         ("\\(current_predicate\\|predicate_property\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
    114         ("\\(a\\(?:bolish\\|ssert[az]\\)\\|clause\\|retract\\(?:all\\)?\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
    115         ("\\(bagof\\|f\\(?:\\(?:ind\\|or\\)all\\)\\|setof\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
    116         ("\\(after\\|before\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
    117         ("\\(phrase\\|expand_term\\|\\(?:goal\\|term\\)_expansion\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
     111        ("\\<\\(parameter\\|se\\(?:lf\\|nder\\)\\|this\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
     112        ("\\<\\(current_predicate\\|predicate_property\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
     113        ("\\<\\(a\\(?:bolish\\|ssert[az]\\)\\|clause\\|retract\\(?:all\\)?\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
     114        ("\\<\\(bagof\\|f\\(?:\\(?:ind\\|or\\)all\\)\\|setof\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
     115        ("\\<\\(after\\|before\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
     116        ("\\<\\(phrase\\|expand_term\\|\\(?:goal\\|term\\)_expansion\\)\\([(]\\)" 1 'logtalk-built-in-method-face) 
    118117    )) 
    119118 
     
    121120(setq logtalk-font-lock-built-in-predicates 
    122121    '( 
    123         ("\\(c\\(?:urrent\\|reate\\)_\\(?:category\\|object\\|protocol\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    124         ("\\(abolish_\\(?:category\\|object\\|protocol\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    125         ("\\(\\(?:category\\|object\\|protocol\\)_property\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    126         ("\\(complements_object\\|extends_\\(?:object\\|protocol\\|category\\)\\|i\\(?:mp\\(?:lements_protocol\\|orts_category\\)\\|nstantiates_class\\)\\|specializes_class\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    127         ("\\(\\(?:abolish\\|define\\)_events\\|current_event\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    128         ("\\(\\(?:curren\\|se\\)t_logtalk_flag\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    129         ("\\(logtalk_\\(?:compile\\|load\\|version\\|library_path\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    130         ("\\(forall\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    131         ("\\(retractall\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     122        ("\\<\\(c\\(?:urrent\\|reate\\)_\\(?:category\\|object\\|protocol\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     123        ("\\<\\(abolish_\\(?:category\\|object\\|protocol\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     124        ("\\<\\(\\(?:category\\|object\\|protocol\\)_property\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     125        ("\\<\\(complements_object\\|extends_\\(?:object\\|protocol\\|category\\)\\|i\\(?:mp\\(?:lements_protocol\\|orts_category\\)\\|nstantiates_class\\)\\|specializes_class\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     126        ("\\<\\(\\(?:abolish\\|define\\)_events\\|current_event\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     127        ("\\<\\(\\(?:curren\\|se\\)t_logtalk_flag\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     128        ("\\<\\(logtalk_\\(?:compile\\|load\\|version\\|library_path\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     129        ("\\<\\(forall\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     130        ("\\<\\(retractall\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    132131        ;; 
    133132        ;; control constructs: 
    134133        ;; 
    135         ("\\(ca\\(?:ll\\|tch\\)\\|throw\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    136         ("\\(fail\\|true\\|!\\|->\\|;\\)" 0 'logtalk-built-in-predicate-face) 
     134        ("\\<\\(ca\\(?:ll\\|tch\\)\\|throw\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     135        ("\\<\\(fail\\|true\\)\\>" 0 'logtalk-built-in-predicate-face) 
     136        ("\\(!\\|->\\|;\\)" 0 'logtalk-built-in-predicate-face) 
    137137        ;; 
    138138        ;; multi-threading: 
    139139        ;; 
    140         ("\\(threaded\\(_\\(?:call\\|once\\|ignore\\|exit\\|peek\\|wait\\|notify\\)\\)?\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     140        ("\\<\\(threaded\\(_\\(?:call\\|once\\|ignore\\|exit\\|peek\\|wait\\|notify\\)\\)?\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    141141        ;; 
    142142        ;; logic and control: 
    143143        ;; 
    144         ("\\(once\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    145         ("\\\\\\+\\|repeat" 0 'logtalk-built-in-predicate-face) 
     144        ("\\<\\(once\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     145        ("\\\\\\+\\|\\<repeat\\>" 0 'logtalk-built-in-predicate-face) 
    146146        ;; 
    147147        ;; term testing: 
    148148        ;; 
    149         ("\\(atom\\(?:ic\\)?\\|compound\\|float\\|\\(?:intege\\|n\\(?:onva\\|umbe\\)\\|va\\)r\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     149        ("\\<\\(atom\\(?:ic\\)?\\|compound\\|float\\|\\(?:intege\\|n\\(?:onva\\|umbe\\)\\|va\\)r\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    150150        ;; 
    151151        ;; term comparison: 
     
    155155        ;; term creation and decomposition: 
    156156        ;; 
    157         ("\\(arg\\|copy_term\\|functor\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     157        ("\\<\\(arg\\|copy_term\\|functor\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    158158        ("=\\.\\." 0 'logtalk-built-in-predicate-face) 
    159159        ;; 
    160160        ;; arithemtic evaluation: 
    161161        ;; 
    162         ("\\<\\is\\>" 0 'logtalk-built-in-predicate-face) 
     162        ("\\<is\\>" 0 'logtalk-built-in-predicate-face) 
    163163        ;; 
    164164        ;; arithemtic comparison: 
     
    175175        ;; evaluable functors: 
    176176        ;; 
    177         ("\\(abs\\|ceiling\\|flo\\(?:at\\(?:_\\(?:\\(?:fractional\\|integer\\)_part\\)\\)?\\|or\\)\\|mod\\|r\\(?:em\\|ound\\)\\|sign\\|truncate\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     177        ("\\<\\(abs\\|ceiling\\|flo\\(?:at\\(?:_\\(?:\\(?:fractional\\|integer\\)_part\\)\\)?\\|or\\)\\|mod\\|r\\(?:em\\|ound\\)\\|sign\\|truncate\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    178178        ("//\\|[*/]" 0 'logtalk-built-in-predicate-face) 
    179179        ("\\([^eE]\\)\\([+]\\)" 2 'logtalk-built-in-predicate-face) 
     
    183183        ;; other arithemtic functors: 
    184184        ;; 
    185         ("\\(atan\\|cos\\|exp\\|log\\|s\\(?:in\\|qrt\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     185        ("\\<\\(atan\\|cos\\|exp\\|log\\|s\\(?:in\\|qrt\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    186186        ("\\*\\*" 1 'logtalk-built-in-predicate-face) 
    187187        ;; 
    188188        ;; stream selection and control: 
    189189        ;; 
    190         ("\\(at_end_of_stream\\|c\\(?:lose\\|urrent_\\(?:\\(?:in\\|out\\)put\\)\\)\\|flush_output\\|open\\|s\\(?:et_\\(?:input\\|output\\|stream_position\\)\\|tream_property\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     190        ("\\<\\(at_end_of_stream\\|c\\(?:lose\\|urrent_\\(?:\\(?:in\\|out\\)put\\)\\)\\|flush_output\\|open\\|s\\(?:et_\\(?:input\\|output\\|stream_position\\)\\|tream_property\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    191191        ("\\<\\(at_end_of_stream\\|flush_output\\)\\>" 0 'logtalk-built-in-predicate-face) 
    192192        ;; 
    193193        ;; character input/output: 
    194194        ;; 
    195         ("\\(get_c\\(?:har\\|ode\\)\\|nl\\|p\\(?:eek_c\\(?:har\\|ode\\)\\|ut_c\\(?:har\\|ode\\)\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     195        ("\\<\\(get_c\\(?:har\\|ode\\)\\|nl\\|p\\(?:eek_c\\(?:har\\|ode\\)\\|ut_c\\(?:har\\|ode\\)\\)\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    196196        ("\\<nl\\>" 0 'logtalk-built-in-predicate-face) 
    197197        ;; 
    198198        ;; byte input/output: 
    199199        ;; 
    200         ("\\(\\(?:get\\|p\\(?:eek\\|ut\\)\\)_byte\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     200        ("\\<\\(\\(?:get\\|p\\(?:eek\\|ut\\)\\)_byte\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    201201        ;; 
    202202        ;; term input/output: 
    203203        ;; 
    204         ("\\(c\\(?:har_conversion\\|urrent_\\(?:char_conversion\\|op\\)\\)\\|op\\|read\\(?:_term\\)?\\|write\\(?:_\\(?:canonical\\|term\\)\\|q\\)?\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     204        ("\\<\\(c\\(?:har_conversion\\|urrent_\\(?:char_conversion\\|op\\)\\)\\|op\\|read\\(?:_term\\)?\\|write\\(?:_\\(?:canonical\\|term\\)\\|q\\)?\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    205205        ;; 
    206206        ;; implementation defined hooks functions: 
    207207        ;; 
    208         ("\\(\\(?:curren\\|se\\)t_prolog_flag\\|halt\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     208        ("\\<\\(\\(?:curren\\|se\\)t_prolog_flag\\|halt\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    209209        ("\\<halt\\>" 0 'logtalk-built-in-predicate-face) 
    210210        ;; 
    211211        ;; atomic term processing: 
    212212        ;; 
    213         ("\\(atom_\\(?:c\\(?:hars\\|o\\(?:des\\|ncat\\)\\)\\|length\\)\\|char_code\\|number_c\\(?:\\(?:har\\|ode\\)s\\)\\|sub_atom\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
     213        ("\\<\\(atom_\\(?:c\\(?:hars\\|o\\(?:des\\|ncat\\)\\)\\|length\\)\\|char_code\\|number_c\\(?:\\(?:har\\|ode\\)s\\)\\|sub_atom\\)\\([(]\\)" 1 'logtalk-built-in-predicate-face) 
    214214        ;; 
    215215        ;; bitwise functors: