summaryrefslogtreecommitdiff
path: root/rc/filetype/r.kak
diff options
context:
space:
mode:
authorSubrata <subrata@iastate.edu>2021-07-22 23:11:40 -0500
committerSubrata <subrata@iastate.edu>2021-07-22 23:11:40 -0500
commita466f2f6d043f47d6d6fc653446881b28736d129 (patch)
treeb1ef2213beac003222710fef181e97ced519c7a5 /rc/filetype/r.kak
parentaaece07ac69de2fa11f35520105c45fc1952de4f (diff)
R file highlights. Added :: etc, added new functions from base::Ops and method::Ops, tried to correct inconsistency with %any% case. Added indexing and assign operator.
Diffstat (limited to 'rc/filetype/r.kak')
-rw-r--r--rc/filetype/r.kak12
1 files changed, 10 insertions, 2 deletions
diff --git a/rc/filetype/r.kak b/rc/filetype/r.kak
index ea8596f2..9b74fca2 100644
--- a/rc/filetype/r.kak
+++ b/rc/filetype/r.kak
@@ -30,19 +30,27 @@ evaluate-commands %sh{
values="TRUE|FALSE|NULL|Inf|NaN|NA|NA_integer_|NA_real_|NA_complex_|NA_character_|\.{3}|\.{2}\d+|"
keywords="if|else|repeat|while|function|for|in|next|break"
+ # see base::Ops and methods::Ops
+ math_functions="abs|sign|sqrt|floor|ceiling|trunc|round|signif|exp|log|expm1|log1p|cos|sin|tan|cospi|sinpi|tanpi|acos|asin|atan|cosh|sinh|tanh|acosh|asinh|atanh|lgamma|gamma|digamma|trigamma"
+ summary_functions="all|any|sum|prod|min|max|range"
+ complex_functions="Arg|Conj|Im|Mod|Re"
+
# Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=python %{
- set-option window static_words ${values} ${keywords}
+ set-option window static_words ${values} ${keywords} ${math_functions} ${summary_functions} ${complex_functions}
}" | tr '|' ' '
printf %s "
add-highlighter shared/r/code/ regex '\b(${values})\b' 0:value
add-highlighter shared/r/code/ regex '\b(${keywords})\b' 0:keyword
+ add-highlighter shared/r/code/ regex '\b(${math_functions})\b' 0:function
+ add-highlighter shared/r/code/ regex '\b(${summary_functions})\b' 0:function
+ add-highlighter shared/r/code/ regex '\b(${complex_functions})\b' 0:function
"
}
# see base::Syntax
-add-highlighter shared/r/code/ regex (?<=[\w\s\d'"_)])(\$|@|\^|-|\+|%[^%]+%|\*|/|<(?![<-])|(?<![->])>|<=|>=|==|!=|!|&{1,2}|\|{1,2}|~|\?) 0:operator
+add-highlighter shared/r/code/ regex (?<=[\w\s\d'"_)])(\$|@|\^|-|\+|%[^%^\n]+%|\*|/|<|>|<=|>=|!|&{1,2}|\|{1,2}|~|\?|:{1,3}|\[{1,2}|\]{1,2}|={1,2}|<{1,2}-|->{1,2}|!=|%%) 0:operator
# Commands