| 1 | # Logtalk language definition file |
|---|
| 2 | # |
|---|
| 3 | # http://logtalk.org/ |
|---|
| 4 | # |
|---|
| 5 | # Author: Paulo Moura |
|---|
| 6 | # Mail: pmoura@logtalk.org |
|---|
| 7 | # Date: 22.11.08 |
|---|
| 8 | # Version: 1.4 |
|---|
| 9 | # ------------------------------------------ |
|---|
| 10 | # This file is a part of highlight, a free source code converter released under the GPL. |
|---|
| 11 | # |
|---|
| 12 | # The file is used to describe keywords and special symbols of programming languages. |
|---|
| 13 | # See README in the highlight directory for details. |
|---|
| 14 | |
|---|
| 15 | $DESCRIPTION=Logtalk |
|---|
| 16 | |
|---|
| 17 | # variables |
|---|
| 18 | $KEYWORDS(kwb)=regex((?<!0')[A-Z_]\w*) |
|---|
| 19 | |
|---|
| 20 | # conditional compilation directives |
|---|
| 21 | $KEYWORDS(kwa)=regex(^\s*:-\s((el)?if)(?=[(]), 1) |
|---|
| 22 | $KEYWORDS(kwa)=regex(^\s*:-\s(e(lse|ndif))(?=\.), 1) |
|---|
| 23 | |
|---|
| 24 | # encapsulation directives |
|---|
| 25 | $KEYWORDS(kwa)=regex(^\s*:-\s(category|protocol|object)(?=[(]), 1) |
|---|
| 26 | $KEYWORDS(kwa)=regex(^\s+((extend|i(mp(or|lemen)t|nstantiate)|specialize)s)(?=[(]), 1) |
|---|
| 27 | $KEYWORDS(kwa)=regex(^\s*:-\s(end_(protocol|category|object))(?=\.), 1) |
|---|
| 28 | |
|---|
| 29 | # entity and predicate directives |
|---|
| 30 | $KEYWORDS(kwa)=regex(^\s*:-\s(calls|public|protected|private|encoding|ensure_loaded|exports|info|initialization|alias|dynamic|discontiguous|meta_predicate|mode|module|multifile|set_logtalk_flag|set_prolog_flag|synchronized|op|uses|use_module)(?=[(]), 1) |
|---|
| 31 | $KEYWORDS(kwa)=regex(^\s*:-\s(dynamic|synchronized|threaded)(?=\.), 1) |
|---|
| 32 | |
|---|
| 33 | # event handlers |
|---|
| 34 | $KEYWORDS(kwc)=regex((after|before)(?=[(]), 1) |
|---|
| 35 | # method execution context |
|---|
| 36 | $KEYWORDS(kwc)=regex((parameter|this|se(lf|nder))(?=[(]), 1) |
|---|
| 37 | # reflection |
|---|
| 38 | $KEYWORDS(kwc)=regex((current_predicate|predicate_property)(?=[(]), 1) |
|---|
| 39 | # DCGs |
|---|
| 40 | $KEYWORDS(kwc)=regex((expand_(goal|term))(?=[(]), 1) |
|---|
| 41 | $KEYWORDS(kwc)=regex(((?:goal|term)_expansion|phrase)(?=[(]), 1) |
|---|
| 42 | # entity |
|---|
| 43 | $KEYWORDS(kwc)=regex(((abolish|c(reate|urrent))_(object|protocol|category))(?=[(]), 1) |
|---|
| 44 | $KEYWORDS(kwc)=regex(((object|protocol|category)_property)(?=[(]), 1) |
|---|
| 45 | # entity relations |
|---|
| 46 | $KEYWORDS(kwc)=regex((complements_object)(?=[(]), 1) |
|---|
| 47 | $KEYWORDS(kwc)=regex((extends_(object|protocol|category))(?=[(]), 1) |
|---|
| 48 | $KEYWORDS(kwc)=regex((imp(lements_protocol|orts_category))(?=[(]), 1) |
|---|
| 49 | $KEYWORDS(kwc)=regex(((instantiat|specializ)es_class)(?=[(]), 1) |
|---|
| 50 | # events |
|---|
| 51 | $KEYWORDS(kwc)=regex((current_event|(abolish|define)_events)(?=[(]), 1) |
|---|
| 52 | # flags |
|---|
| 53 | $KEYWORDS(kwc)=regex(((current|set)_logtalk_flag)(?=[(]), 1) |
|---|
| 54 | # compiling, loading, and library paths |
|---|
| 55 | $KEYWORDS(kwc)=regex((logtalk_(compile|l(ibrary_path|oad)))(?=[(]), 1) |
|---|
| 56 | # database |
|---|
| 57 | $KEYWORDS(kwc)=regex((clause|retract(all)?)(?=[(]), 1) |
|---|
| 58 | $KEYWORDS(kwc)=regex((a(bolish|ssert(a|z)))(?=[(]), 1) |
|---|
| 59 | # control |
|---|
| 60 | $KEYWORDS(kwc)=regex((call|catch|throw)(?=[(]), 1) |
|---|
| 61 | $KEYWORDS(kwc)=regex((fail|true), 1) |
|---|
| 62 | # all solutions |
|---|
| 63 | $KEYWORDS(kwc)=regex((bagof|setof|findall|forall)(?=[(]), 1) |
|---|
| 64 | # multi-threading meta-predicates |
|---|
| 65 | $KEYWORDS(kwc)=regex((threaded(_(call|once|ignore|exit|peek|wait|notify))?)(?=[(]), 1) |
|---|
| 66 | # term unification |
|---|
| 67 | $KEYWORDS(kwc)=regex((unify_with_occurs_check)(?=[(]), 1) |
|---|
| 68 | # term creation and decomposition |
|---|
| 69 | $KEYWORDS(kwc)=regex((functor|arg|copy_term)(?=[(]), 1) |
|---|
| 70 | # evaluable functors |
|---|
| 71 | $KEYWORDS(kwc)=regex((rem|mod|abs|sign)(?=[(]), 1) |
|---|
| 72 | $KEYWORDS(kwc)=regex((float(_(integer|fractional)_part)?)(?=[(]), 1) |
|---|
| 73 | $KEYWORDS(kwc)=regex((floor|truncate|round|ceiling)(?=[(]), 1) |
|---|
| 74 | # other arithmetic functors |
|---|
| 75 | $KEYWORDS(kwc)=regex((cos|atan|exp|log|s(in|qrt))(?=[(]), 1) |
|---|
| 76 | # term testing |
|---|
| 77 | $KEYWORDS(kwc)=regex((var|atomic|atom|integer|float|compound|nonvar|number)(?=[(]), 1) |
|---|
| 78 | # stream selection and control |
|---|
| 79 | $KEYWORDS(kwc)=regex(((curren|se)t_(in|out)put)(?=[(]), 1) |
|---|
| 80 | $KEYWORDS(kwc)=regex((open|close)(?=[(]), 1) |
|---|
| 81 | $KEYWORDS(kwc)=regex((flush_output)(?=[(]), 1) |
|---|
| 82 | $KEYWORDS(kwc)=regex((flush_output), 1) |
|---|
| 83 | $KEYWORDS(kwc)=regex((stream_property|at_end_of_stream|set_stream_position)(?=[(]), 1) |
|---|
| 84 | $KEYWORDS(kwc)=regex((at_end_of_stream), 1) |
|---|
| 85 | # character and byte input/output |
|---|
| 86 | $KEYWORDS(kwc)=regex((nl|(get|peek|put)_(byte|char|code))(?=[(]), 1) |
|---|
| 87 | $KEYWORDS(kwc)=regex((nl), 1) |
|---|
| 88 | # term input/output |
|---|
| 89 | $KEYWORDS(kwc)=regex((read(_term)?)(?=[(]), 1) |
|---|
| 90 | $KEYWORDS(kwc)=regex((write(q|_(canonical|term))?)(?=[(]), 1) |
|---|
| 91 | $KEYWORDS(kwc)=regex(((current_)?op)(?=[(]), 1) |
|---|
| 92 | $KEYWORDS(kwc)=regex(((current_)?char_conversion)(?=[(]), 1) |
|---|
| 93 | # atomic term processing |
|---|
| 94 | $KEYWORDS(kwc)=regex((atom_(length|c(hars|o(ncat|des))))(?=[(]), 1) |
|---|
| 95 | $KEYWORDS(kwc)=regex((char_code|sub_atom)(?=[(]), 1) |
|---|
| 96 | $KEYWORDS(kwc)=regex((number_c(har|ode)s)(?=[(]), 1) |
|---|
| 97 | # implementation defined hooks functions |
|---|
| 98 | $KEYWORDS(kwc)=regex(((?:se|curren)t_prolog_flag)(?=[(]), 1) |
|---|
| 99 | $KEYWORDS(kwc)=regex((halt), 1) |
|---|
| 100 | $KEYWORDS(kwc)=regex((halt)(?=[(]), 1) |
|---|
| 101 | # logic and control |
|---|
| 102 | $KEYWORDS(kwc)=regex((once)(?=[(]), 1) |
|---|
| 103 | $KEYWORDS(kwc)=regex((repeat), 1) |
|---|
| 104 | |
|---|
| 105 | # Logtalk message sending operators |
|---|
| 106 | $KEYWORDS(kwd)=regex((::|\^\^|<<|:)) |
|---|
| 107 | # Logtalk external-call control construct |
|---|
| 108 | $KEYWORDS(kwd)=regex(([{}])) |
|---|
| 109 | # Prolog operators |
|---|
| 110 | $KEYWORDS(kwd)=regex((\\\+|->|=\.\.|;|!|:-|\^)) |
|---|
| 111 | # Prolog arithmetic operators |
|---|
| 112 | $KEYWORDS(kwd)=regex((is|mod|rem|//|[+\-]|/(?!\*)|(?<=\*)/|[*][*])) |
|---|
| 113 | # Prolog arithmetic comparison operators |
|---|
| 114 | $KEYWORDS(kwd)=regex((=<|<|=:=|=\\=|>=|>)) |
|---|
| 115 | # Prolog term comparison operators |
|---|
| 116 | $KEYWORDS(kwd)=regex((@<|@=<|==|\\==|@>|@>=)) |
|---|
| 117 | # Prolog unification operators |
|---|
| 118 | $KEYWORDS(kwd)=regex((=|\\=)) |
|---|
| 119 | # Logtalk mode operators |
|---|
| 120 | $KEYWORDS(kwd)=regex((\?|@)) |
|---|
| 121 | # Prolog bitwise operators |
|---|
| 122 | $KEYWORDS(kwd)=regex((/\\|\\/|>>|\\)) |
|---|
| 123 | |
|---|
| 124 | $STRINGDELIMITERS=" ' |
|---|
| 125 | |
|---|
| 126 | # numbers |
|---|
| 127 | $KEYWORDS(kwc)=regex((0['].), 1) |
|---|
| 128 | $KEYWORDS(kwc)=regex((0b[0-1]+|0o[0-7]+|0x\p{XDigit}+), 1) |
|---|
| 129 | $KEYWORDS(kwc)=regex((\d+(\.\d+)?([eE]([-+])?\d+)?), 1) |
|---|
| 130 | |
|---|
| 131 | $SL_COMMENT=% |
|---|
| 132 | |
|---|
| 133 | $ML_COMMENT=/* */ |
|---|
| 134 | |
|---|
| 135 | $ALLOWNESTEDCOMMENTS=false |
|---|
| 136 | |
|---|
| 137 | $IGNORECASE=false |
|---|
| 138 | |
|---|
| 139 | $ESCCHAR=regex(\\[0-7]+\\|\\x\p{XDigit}+\\|\\[abfnrtv\\'"]) |
|---|
| 140 | |
|---|
| 141 | $SYMBOLS= ( ) [ ] { } , ; : & | < > ! = / * + - |
|---|