Remove uses of \< and \>, always use std regex compatible \b

This commit is contained in:
Maxime Coste 2016-04-21 20:43:17 +01:00
parent de033d2915
commit 3f74dd2924
32 changed files with 121 additions and 121 deletions

View File

@ -21,7 +21,7 @@ addhl -group / group clojure
addhl -group /clojure ref lisp
addhl -group /clojure regex \<(clojure.core/['/\w]+)\> 0:keyword
addhl -group /clojure regex \b(clojure.core/['/\w]+)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -28,10 +28,10 @@ addhl -group /dlang/token fill meta
addhl -group /dlang/disabled fill rgb:777777
addhl -group /dlang/comment fill comment
addhl -group /dlang/string regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\>} 0:value
addhl -group /dlang/string regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\b} 0:value
addhl -group /dlang/code regex %{'((\\.)?|[^'\\])'} 0:value
addhl -group /dlang/code regex "-?([0-9_]*\.(?!0[xXbB]))?\<([0-9_]+|0[xX][0-9a-fA-F_]*\.?[0-9a-fA-F_]+|0[bb][01_]+)([ep]-?[0-9_]+)?[fFlLuUi]*\>" 0:value
addhl -group /dlang/code regex "\<(this)\>\s*[^(]" 1:value
addhl -group /dlang/code regex "-?([0-9_]*\.(?!0[xXbB]))?\b([0-9_]+|0[xX][0-9a-fA-F_]*\.?[0-9a-fA-F_]+|0[bb][01_]+)([ep]-?[0-9_]+)?[fFlLuUi]*\b" 0:value
addhl -group /dlang/code regex "\b(this)\b\s*[^(]" 1:value
%sh{
# Grammar
@ -59,11 +59,11 @@ addhl -group /dlang/code regex "\<(this)\>\s*[^(]" 1:value
# Highlight keywords
printf %s "
addhl -group /dlang/code regex \<(${keywords})\> 0:keyword
addhl -group /dlang/code regex \<(${attributes})\> 0:attribute
addhl -group /dlang/code regex \<(${types})\> 0:type
addhl -group /dlang/code regex \<(${values})\> 0:value
addhl -group /dlang/code regex @(${decorators})\> 0:attribute
addhl -group /dlang/code regex \b(${keywords})\b 0:keyword
addhl -group /dlang/code regex \b(${attributes})\b 0:attribute
addhl -group /dlang/code regex \b(${types})\b 0:type
addhl -group /dlang/code regex \b(${values})\b 0:value
addhl -group /dlang/code regex @(${decorators})\b 0:attribute
"
}

View File

@ -28,7 +28,7 @@ addhl -group /fish/comment fill comment
addhl -group /fish/code regex (\$\w+)|(\{\$\w+\}) 0:identifier
# Command names are collected using `builtin --names` and 'eval' from `functions --names`
addhl -group /fish/code regex \<(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\> 0:keyword
addhl -group /fish/code regex \b(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -7,7 +7,7 @@ hook global WinSetOption filetype=git-commit %{
addhl -group git-commit-highlight regex "\`[^\n]{1,50}" 0:yellow
addhl -group git-commit-highlight regex "\`[^\n]*\n\h*(?!#)([^\n]*)\n?" 1:default,red
addhl -group git-commit-highlight regex "^\h*#[^\n]*\n" 0:cyan,default
addhl -group git-commit-highlight regex "\<(?:(modified)|(deleted)|(new file)|(renamed)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta
addhl -group git-commit-highlight regex "\b(?:(modified)|(deleted)|(new file)|(renamed)):([^\n]*)\n" 1:yellow 2:red 3:green 4:blue 5:magenta
}
hook global WinSetOption filetype=(?!git-commit).* %{

View File

@ -24,7 +24,7 @@ addhl -group /golang/double_string fill string
addhl -group /golang/single_string fill string
addhl -group /golang/comment fill comment
addhl -group /golang/code regex %{-?([0-9]*\.(?!0[xX]))?\<([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\>} 0:value
addhl -group /golang/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value
%sh{
# Grammar
@ -42,10 +42,10 @@ addhl -group /golang/code regex %{-?([0-9]*\.(?!0[xX]))?\<([0-9]+|0[xX][0-9a-fA-
# Highlight keywords
printf %s "
addhl -group /golang/code regex \<(${keywords})\> 0:keyword
addhl -group /golang/code regex \<(${attributes})\> 0:attribute
addhl -group /golang/code regex \<(${types})\> 0:type
addhl -group /golang/code regex \<(${values})\> 0:value
addhl -group /golang/code regex \b(${keywords})\b 0:keyword
addhl -group /golang/code regex \b(${attributes})\b 0:attribute
addhl -group /golang/code regex \b(${types})\b 0:type
addhl -group /golang/code regex \b(${values})\b 0:value
"
}

View File

@ -25,10 +25,10 @@ addhl -group /haskell/string fill string
addhl -group /haskell/comment fill comment
addhl -group /haskell/macro fill meta
addhl -group /haskell/code regex \<(import)\> 0:meta
addhl -group /haskell/code regex \<(True|False)\> 0:value
addhl -group /haskell/code regex \<(as|case|class|data|default|deriving|do|else|hiding|if|in|infix|infixl|infixr|instance|let|module|newtype|of|qualified|then|type|where)\> 0:keyword
addhl -group /haskell/code regex \<(Int|Integer|Char|Bool|Float|Double|IO|Void|Addr|Array|String)\> 0:type
addhl -group /haskell/code regex \b(import)\b 0:meta
addhl -group /haskell/code regex \b(True|False)\b 0:value
addhl -group /haskell/code regex \b(as|case|class|data|default|deriving|do|else|hiding|if|in|infix|infixl|infixr|instance|let|module|newtype|of|qualified|then|type|where)\b 0:keyword
addhl -group /haskell/code regex \b(Int|Integer|Char|Bool|Float|Double|IO|Void|Addr|Array|String)\b 0:type
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -18,8 +18,8 @@ hook global BufCreate .*[.](html) %{
addhl -group / regions html \
comment <!-- --> '' \
tag < > '' \
style <style\>.*?>\K (?=</style>) '' \
script <script\>.*?>\K (?=</script>) ''
style <style\b.*?>\K (?=</style>) '' \
script <script\b.*?>\K (?=</script>) ''
addhl -group /html/comment fill comment

View File

@ -14,10 +14,10 @@ addhl -group / regions -default code java \
addhl -group /java/string fill string
addhl -group /java/comment fill comment
addhl -group /java/code regex %{\<(this|true|false|null)\>} 0:value
addhl -group /java/code regex "\<(void|int|char|unsigned|float|boolean|double)\>" 0:type
addhl -group /java/code regex "\<(while|for|if|else|do|static|switch|case|default|class|interface|goto|break|continue|return|import|try|catch|throw|new|package|extends|implements)\>" 0:keyword
addhl -group /java/code regex "\<(final|public|protected|private|abstract)\>" 0:attribute
addhl -group /java/code regex %{\b(this|true|false|null)\b} 0:value
addhl -group /java/code regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type
addhl -group /java/code regex "\b(while|for|if|else|do|static|switch|case|default|class|interface|goto|break|continue|return|import|try|catch|throw|new|package|extends|implements)\b" 0:keyword
addhl -group /java/code regex "\b(final|public|protected|private|abstract)\b" 0:attribute
hook global WinSetOption filetype=java %{
addhl ref java

View File

@ -26,14 +26,14 @@ addhl -group /javascript/single_string fill string
addhl -group /javascript/comment fill comment
addhl -group /javascript/code regex \$\w* 0:identifier
addhl -group /javascript/code regex \<(document|false|null|parent|self|this|true|undefined|window)\> 0:value
addhl -group /javascript/code regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value
addhl -group /javascript/code regex "-?[0-9]*\.?[0-9]+" 0:value
addhl -group /javascript/code regex \<(Array|Boolean|Date|Function|Number|Object|RegExp|String)\> 0:type
addhl -group /javascript/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
addhl -group /javascript/code regex (?<=\W)/[^\n/]+/[gimy]* 0:meta
# Keywords are collected at
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
addhl -group /javascript/code regex \<(break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|let|new|of|return|super|switch|throw|try|typeof|var|void|while|with|yield)\> 0:keyword
addhl -group /javascript/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|let|new|of|return|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -20,7 +20,7 @@ addhl -group / regions -default code json \
addhl -group /json/string fill string
addhl -group /json/code regex \<(true|false|null)\> 0:value
addhl -group /json/code regex \b(true|false|null)\b 0:value
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -19,9 +19,9 @@ addhl -group /julia/string fill string
addhl -group /julia/comment fill comment
# taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el
addhl -group /julia/code regex %{\<(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\<-?\d+[fdiu]?)\>} 0:value
addhl -group /julia/code regex \<(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\> 0:keyword
addhl -group /julia/code regex \<(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\> 0:type
addhl -group /julia/code regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value
addhl -group /julia/code regex \b(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\b 0:keyword
addhl -group /julia/code regex \b(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\b 0:type
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -22,10 +22,10 @@ addhl -group / regions -default code lisp \
addhl -group /lisp/string fill string
addhl -group /lisp/comment fill comment
addhl -group /lisp/code regex \<(nil|true|false)\> 0:value
addhl -group /lisp/code regex \b(nil|true|false)\b 0:value
addhl -group /lisp/code regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=|) 0:operator
addhl -group /lisp/code regex \<(([':]\w+)|([*]\H+[*]))\> 0:identifier
addhl -group /lisp/code regex \<(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\> 0:keyword
addhl -group /lisp/code regex \b(([':]\w+)|([*]\H+[*]))\b 0:identifier
addhl -group /lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -27,7 +27,7 @@ addhl -group /lua/string fill string
addhl -group /lua/comment fill comment
addhl -group /lua/code regex \<(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\> 0:keyword
addhl -group /lua/code regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -32,7 +32,7 @@ addhl -group /makefile/content regex [+?:]= 0:operator
}" | sed 's,|,:,g'
# Highlight keywords
printf %s "addhl -group /makefile/content regex \<(${keywords})\> 0:keyword"
printf %s "addhl -group /makefile/content regex \b(${keywords})\b 0:keyword"
}
# Commands

View File

@ -50,29 +50,29 @@ addhl -group /perl/comment fill comment
# Highlight keywords
printf %s "
addhl -group /perl/code regex \<(${keywords})\> 0:keyword
addhl -group /perl/code regex \<(${attributes})\> 0:attribute
addhl -group /perl/code regex \<(${values})\> 0:value
addhl -group /perl/code regex \b(${keywords})\b 0:keyword
addhl -group /perl/code regex \b(${attributes})\b 0:attribute
addhl -group /perl/code regex \b(${values})\b 0:value
"
}
addhl -group /perl/code regex (?!\$)-?([0-9]*\.(?!0[xXbB]))?\<([0-9]+|0[xX][0-9a-fA-F]+|0[bb][01_]+)\.?([eE][+-]?[0-9]+)?i?\> 0:value
addhl -group /perl/code regex (?!\$)-?([0-9]*\.(?!0[xXbB]))?\b([0-9]+|0[xX][0-9a-fA-F]+|0[bb][01_]+)\.?([eE][+-]?[0-9]+)?i?\b 0:value
addhl -group /perl/code regex %{\$!|\$"|\$#|\$\$|\$%|\$&|\$'|\$\(|\$\)|\$\*|\$\+|\$,|\$_|\$-|\$`|\$\.|\$/|\$:|\$;|\$<|\$=|\$>|\$\?|\$@|\$\[|\$\\|\$\]|\$\^|\$\||\$~|%!|@\+|@-|@_} 0:value
addhl -group /perl/code regex (%ENV|%INC|%OVERLOAD|%SIG|@ARGV|@INC|@LAST_MATCH_START) 0:value
addhl -group /perl/code regex %{%\^(H)\>} 0:value
addhl -group /perl/code regex \$\^(S|T|V|W|X|A|C|D|E|F|H|I|L|M|N|O|P|R)\> 0:value
addhl -group /perl/code regex \$\^(RE_TRIE_MAXBUF|TAINT|UNICODE|UTF8LOCALE|WARNING_BITS|WIDE_SYSTEM_CALLS|CHILD_ERROR_NATIVE|ENCODING|OPEN|RE_DEBUG_FLAGS)\> 0:value
addhl -group /perl/code regex %{%\^(H)\b} 0:value
addhl -group /perl/code regex \$\^(S|T|V|W|X|A|C|D|E|F|H|I|L|M|N|O|P|R)\b 0:value
addhl -group /perl/code regex \$\^(RE_TRIE_MAXBUF|TAINT|UNICODE|UTF8LOCALE|WARNING_BITS|WIDE_SYSTEM_CALLS|CHILD_ERROR_NATIVE|ENCODING|OPEN|RE_DEBUG_FLAGS)\b 0:value
addhl -group /perl/code regex \$[0-9]+ 0:attribute
addhl -group /perl/code regex \<-(B|b|C|c|d|e|f|g|k|l|M|O|o|p|r|R|S|s|T|t|u|w|W|X|x|z)\> 0:attribute
addhl -group /perl/code regex \b-(B|b|C|c|d|e|f|g|k|l|M|O|o|p|r|R|S|s|T|t|u|w|W|X|x|z)\b 0:attribute
addhl -group /perl/code regex %{(?:\<[stqrmwy]+)?/[^\n/]*/([msixpodualngecr]+\>)?} 0:magenta
addhl -group /perl/code regex %{(?:\<[stqrmwy]+)?/[^\n/]+/[^\n/]*/([msixpeodualngcr]+\>)?} 0:magenta
addhl -group /perl/code regex %{(?:\b[stqrmwy]+)?/[^\n/]*/([msixpodualngecr]+\b)?} 0:magenta
addhl -group /perl/code regex %{(?:\b[stqrmwy]+)?/[^\n/]+/[^\n/]*/([msixpeodualngcr]+\b)?} 0:magenta
addhl -group /perl/code regex \$[a-zA-Z_][a-zA-Z0-9_]* 0:blue
addhl -group /perl/code regex \$(a|b|LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR)\> 0:value
addhl -group /perl/code regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR|PERL_VERSION|ACCUMULATOR|PERLDB|ARG|PID|ARGV|POSTMATCH|PREMATCH|BASETIME|PROCESS_ID|CHILD_ERROR|PROGRAM_NAME|COMPILING|REAL_GROUP_ID|DEBUGGING|REAL_USER_ID|EFFECTIVE_GROUP_ID|RS|EFFECTIVE_USER_ID|SUBSCRIPT_SEPARATOR|EGID|SUBSEP|ERRNO|SYSTEM_FD_MAX|EUID|UID|EVAL_ERROR|WARNING|EXCEPTIONS_BEING_CAUGHT|EXECUTABLE_NAME|EXTENDED_OS_ERROR|FORMAT_FORMFEED|FORMAT_LINE_BREAK_CHARACTERS|FORMAT_LINES_LEFT|FORMAT_LINES_PER_PAGE|FORMAT_NAME|FORMAT_PAGE_NUMBER|FORMAT_TOP_NAME|GID|INPLACE_EDIT|INPUT_LINE_NUMBER|INPUT_RECORD_SEPARATOR|LAST_MATCH_END|LAST_PAREN_MATCH)\> 0:value
addhl -group /perl/code regex \$(a|b|LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR)\b 0:value
addhl -group /perl/code regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR|PERL_VERSION|ACCUMULATOR|PERLDB|ARG|PID|ARGV|POSTMATCH|PREMATCH|BASETIME|PROCESS_ID|CHILD_ERROR|PROGRAM_NAME|COMPILING|REAL_GROUP_ID|DEBUGGING|REAL_USER_ID|EFFECTIVE_GROUP_ID|RS|EFFECTIVE_USER_ID|SUBSCRIPT_SEPARATOR|EGID|SUBSEP|ERRNO|SYSTEM_FD_MAX|EUID|UID|EVAL_ERROR|WARNING|EXCEPTIONS_BEING_CAUGHT|EXECUTABLE_NAME|EXTENDED_OS_ERROR|FORMAT_FORMFEED|FORMAT_LINE_BREAK_CHARACTERS|FORMAT_LINES_LEFT|FORMAT_LINES_PER_PAGE|FORMAT_NAME|FORMAT_PAGE_NUMBER|FORMAT_TOP_NAME|GID|INPLACE_EDIT|INPUT_LINE_NUMBER|INPUT_RECORD_SEPARATOR|LAST_MATCH_END|LAST_PAREN_MATCH)\b 0:value
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -51,7 +51,7 @@ addhl -group /ruby/comment fill comment
addhl -group /ruby/literal fill meta
addhl -group /ruby/code regex \<([A-Za-z]\w*:)|([$@][A-Za-z]\w*)|(\W\K:[A-Za-z]\w*[=?!]?) 0:identifier
addhl -group /ruby/code regex \b([A-Za-z]\w*:)|([$@][A-Za-z]\w*)|(\W\K:[A-Za-z]\w*[=?!]?) 0:identifier
%sh{
# Grammar
@ -71,10 +71,10 @@ addhl -group /ruby/code regex \<([A-Za-z]\w*:)|([$@][A-Za-z]\w*)|(\W\K:[A-Za-z]\
# Highlight keywords
printf %s "
addhl -group /ruby/code regex \<(${keywords})\> 0:keyword
addhl -group /ruby/code regex \<(${attributes})\> 0:attribute
addhl -group /ruby/code regex \<(${values})\> 0:value
addhl -group /ruby/code regex \<(${meta})\> 0:meta
addhl -group /ruby/code regex \b(${keywords})\b 0:keyword
addhl -group /ruby/code regex \b(${attributes})\b 0:attribute
addhl -group /ruby/code regex \b(${values})\b 0:value
addhl -group /ruby/code regex \b(${meta})\b 0:meta
"
}

View File

@ -24,17 +24,17 @@ addhl -group / regions -default code rust \
addhl -group /rust/string fill string
addhl -group /rust/comment fill comment
addhl -group /rust/code regex \<[A-z0-9_]+! 0:meta
addhl -group /rust/code regex \b[A-z0-9_]+! 0:meta
# the number literals syntax is defined here:
# https://doc.rust-lang.org/reference.html#number-literals
addhl -group /rust/code regex \<(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u)(?:8|16|32|64|size))?)\> 0:value
addhl -group /rust/code regex \<(?:&&|\|\|)\> 0:operator
addhl -group /rust/code regex \b(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u)(?:8|16|32|64|size))?)\b 0:value
addhl -group /rust/code regex \b(?:&&|\|\|)\b 0:operator
# the language keywords are defined here, but many of them are reserved and unused yet:
# https://doc.rust-lang.org/grammar.html#keywords
addhl -group /rust/code regex \<(?:crate|use|extern)\> 0:meta
addhl -group /rust/code regex \<(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|pub|unsafe)\> 0:keyword
addhl -group /rust/code regex \<(?:mod|trait|struct|enum|type|mut|ref|static|const)\> 0:attribute
addhl -group /rust/code regex \<(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f32|f64|bool|char|str|Self)\> 0:type
addhl -group /rust/code regex \b(?:crate|use|extern)\b 0:meta
addhl -group /rust/code regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|pub|unsafe)\b 0:keyword
addhl -group /rust/code regex \b(?:mod|trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
addhl -group /rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f32|f64|bool|char|str|Self)\b 0:type
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -28,11 +28,11 @@ addhl -group /scala/comment fill comment
# Keywords are collected at
# http://tutorialspoint.com/scala/scala_basic_syntax.htm
addhl -group /scala/code regex \<(import|package)\> 0:meta
addhl -group /scala/code regex \<(this|true|false|null)\> 0:value
addhl -group /scala/code regex \<(become|case|catch|class|def|do|else|extends|final|finally|for|forSome|goto|if|initialize|macro|match|new|object|onTransition|return|startWith|stay|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\> 0:keyword
addhl -group /scala/code regex \<(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed|super)\> 0:attribute
addhl -group /scala/code regex \<(⇒|=>|<:|:>|=:=|::|&&|\|\|)\> 0:operator
addhl -group /scala/code regex \b(import|package)\b 0:meta
addhl -group /scala/code regex \b(this|true|false|null)\b 0:value
addhl -group /scala/code regex \b(become|case|catch|class|def|do|else|extends|final|finally|for|forSome|goto|if|initialize|macro|match|new|object|onTransition|return|startWith|stay|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\b 0:keyword
addhl -group /scala/code regex \b(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed|super)\b 0:attribute
addhl -group /scala/code regex \b(⇒|=>|<:|:>|=:=|::|&&|\|\|)\b 0:operator
addhl -group /scala/code regex "'[_A-Za-z0-9$]+" 0:identifier
# Commands

View File

@ -26,7 +26,7 @@ addhl -group /yaml/comment fill comment
addhl -group /yaml/code regex ^(---|\.\.\.)$ 0:meta
addhl -group /yaml/code regex ^(\h*:\w*) 0:keyword
addhl -group /yaml/code regex \<(true|false|null)\> 0:value
addhl -group /yaml/code regex \b(true|false|null)\b 0:value
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -93,7 +93,7 @@ def -hidden _c-family-indent-on-closing-curly-brace %[
}
# c specific
addhl -group /c/code regex %{\<NULL\>|\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
addhl -group /c/code regex %{\bNULL\b|\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
keywords="while|for|if|else|do|switch|case|default|goto|asm|break|continue|return|sizeof"
@ -109,14 +109,14 @@ addhl -group /c/code regex %{\<NULL\>|\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[
# Highlight keywords
printf %s "
addhl -group /c/code regex \<(${keywords})\> 0:keyword
addhl -group /c/code regex \<(${attributes})\> 0:attribute
addhl -group /c/code regex \<(${types})\> 0:type
addhl -group /c/code regex \b(${keywords})\b 0:keyword
addhl -group /c/code regex \b(${attributes})\b 0:attribute
addhl -group /c/code regex \b(${types})\b 0:type
"
}
# c++ specific
addhl -group /cpp/code regex %{\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
addhl -group /cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
@ -142,15 +142,15 @@ addhl -group /cpp/code regex %{\<-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[^'\\])'
# Highlight keywords
printf %s "
addhl -group /cpp/code regex \<(${keywords})\> 0:keyword
addhl -group /cpp/code regex \<(${attributes})\> 0:attribute
addhl -group /cpp/code regex \<(${types})\> 0:type
addhl -group /cpp/code regex \<(${values})\> 0:value
addhl -group /cpp/code regex \b(${keywords})\b 0:keyword
addhl -group /cpp/code regex \b(${attributes})\b 0:attribute
addhl -group /cpp/code regex \b(${types})\b 0:type
addhl -group /cpp/code regex \b(${values})\b 0:value
"
}
# objective-c specific
addhl -group /objc/code regex %{\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
addhl -group /objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
%sh{
# Grammar
@ -171,11 +171,11 @@ addhl -group /objc/code regex %{\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
# Highlight keywords
printf %s "
addhl -group /objc/code regex \<(${keywords})\> 0:keyword
addhl -group /objc/code regex \<(${attributes})\> 0:attribute
addhl -group /objc/code regex \<(${types})\> 0:type
addhl -group /objc/code regex \<(${values})\> 0:value
addhl -group /objc/code regex @(${decorators})\> 0:attribute
addhl -group /objc/code regex \b(${keywords})\b 0:keyword
addhl -group /objc/code regex \b(${attributes})\b 0:attribute
addhl -group /objc/code regex \b(${types})\b 0:type
addhl -group /objc/code regex \b(${values})\b 0:value
addhl -group /objc/code regex @(${decorators})\b 0:attribute
"
}

View File

@ -22,15 +22,15 @@ addhl -group / regions -default code kakrc \
# Highlight keywords
printf %s "
addhl -group /kakrc/code regex \<(${keywords})\> 0:keyword
addhl -group /kakrc/code regex \<(${values})\> 0:value
addhl -group /kakrc/code regex \b(${keywords})\b 0:keyword
addhl -group /kakrc/code regex \b(${values})\b 0:value
"
}
addhl -group /kakrc/code regex \<rgb:[0-9a-fA-F]{6}\> 0:value
addhl -group /kakrc/code regex (?:\<hook)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string
addhl -group /kakrc/code regex (?:\<set)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string
addhl -group /kakrc/code regex (?:\<map)\h+(?:(global|buffer|window)|(\S+))\h+(?:(normal|insert|prompt|menu)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:attribute 4:error 5:identifier 6:string
addhl -group /kakrc/code regex \brgb:[0-9a-fA-F]{6}\b 0:value
addhl -group /kakrc/code regex (?:\bhook)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string
addhl -group /kakrc/code regex (?:\bset)\h+(?:(global|buffer|window)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:identifier 4:string
addhl -group /kakrc/code regex (?:\bmap)\h+(?:(global|buffer|window)|(\S+))\h+(?:(normal|insert|prompt|menu)|(\S+))\h+(\S+)\h+(\S+)? 1:attribute 2:error 3:attribute 4:error 5:identifier 6:string
addhl -group /kakrc/double_string fill string
addhl -group /kakrc/single_string fill string

View File

@ -41,13 +41,13 @@ addhl -group /python/comment fill comment
# Highlight keywords
printf %s "
addhl -group /python/code regex '\<(${values})\>' 0:value
addhl -group /python/code regex '\<(${meta})\>' 0:meta
addhl -group /python/code regex '\<(${keywords})\>' 0:keyword
addhl -group /python/code regex '\b(${values})\b' 0:value
addhl -group /python/code regex '\b(${meta})\b' 0:meta
addhl -group /python/code regex '\b(${keywords})\b' 0:keyword
"
# Highlight types, when they are not used as constructors
printf %s "addhl -group /python/code regex '\<(${types})\>[^(]' 1:type"
printf %s "addhl -group /python/code regex '\b(${types})\b[^(]' 1:type"
}
# Commands

View File

@ -29,7 +29,7 @@ addhl -group /sh/comment fill comment
}" | sed 's,|,:,g'
# Highlight keywords
printf %s "addhl -group /sh/code regex \<(${keywords})\> 0:keyword"
printf %s "addhl -group /sh/code regex \b(${keywords})\b 0:keyword"
}
addhl -group /sh/code regex [\[\]\(\)&|]{2}|\[\s|\s\] 0:operator

View File

@ -21,8 +21,8 @@ addhl -group / regions -default code cabal \
addhl -group /cabal/comment fill comment
addhl -group /cabal/code regex \<(true|false)\>|(([<>]?=?)?\d+(\.\d+)+) 0:value
addhl -group /cabal/code regex \<(if|else)\> 0:keyword
addhl -group /cabal/code regex \b(true|false)\b|(([<>]?=?)?\d+(\.\d+)+) 0:value
addhl -group /cabal/code regex \b(if|else)\b 0:keyword
addhl -group /cabal/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*: 1:identifier
# Commands

View File

@ -43,10 +43,10 @@ addhl -group /coffee/comment fill comment
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
# http://coffeescript.org/documentation/docs/lexer.html#section-63
addhl -group /coffee/code regex [$@]\w* 0:identifier
addhl -group /coffee/code regex \<(Array|Boolean|Date|Function|Number|Object|RegExp|String)\> 0:type
addhl -group /coffee/code regex \<(document|false|no|null|off|on|parent|self|this|true|undefined|window|yes)\> 0:value
addhl -group /coffee/code regex \<(and|is|isnt|not|or)\> 0:operator
addhl -group /coffee/code regex \<(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|if|implements|import|in|instanceof|interface|let|native|new|package|private|protected|public|return|static|super|switch|throw|try|typeof|var|void|while|with|yield)\> 0:keyword
addhl -group /coffee/code regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String)\b 0:type
addhl -group /coffee/code regex \b(document|false|no|null|off|on|parent|self|this|true|undefined|window|yes)\b 0:value
addhl -group /coffee/code regex \b(and|is|isnt|not|or)\b 0:operator
addhl -group /coffee/code regex \b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|function|if|implements|import|in|instanceof|interface|let|native|new|package|private|protected|public|return|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -55,7 +55,7 @@ addhl -group /cucumber/language regex \S+$ 0:value
# …
# }
addhl -group /cucumber/code regex \<(Feature|Business\h+Need|Ability|Background|Scenario|Scenario\h+Outline|Scenario\h+Template|Examples|Scenarios|Given|When|Then|And|But)\> 0:keyword
addhl -group /cucumber/code regex \b(Feature|Business\h+Need|Ability|Background|Scenario|Scenario\h+Outline|Scenario\h+Template|Examples|Scenarios|Given|When|Then|And|But)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -6,12 +6,12 @@ addhl -group / regions -default code kickstart \
comment (^|\h)\K\# $ '' \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
packages '^\h*\K%packages\>' '^\h*\K%end\>' '' \
shell '^\h*\K%(pre|pre-install|post)\>' '^\h*\K%end\>' ''
packages '^\h*\K%packages\b' '^\h*\K%end\b' '' \
shell '^\h*\K%(pre|pre-install|post)\b' '^\h*\K%end\b' ''
addhl -group /kickstart/code regex "^\h*\<(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\>" 1:keyword
addhl -group /kickstart/code regex "^\h*\b(auth|authconfig|autopart|autostep|bootloader|btrfs|clearpart|cmdline|device|dmraid|driverdisk|fcoe|firewall|firstboot|group|graphical|halt|ignoredisk|install|cdrom|harddrive|liveimg|nfs|url|iscsi|iscsiname|keyboard|lang|logvol|logging|mediacheck|monitor|multipath|network|part|partition|poweroff|raid|realm|reboot|repo|rescue|rootpw|selinux|services|shutdown|sshkey|sshpw|skipx|text|timezone|updates|upgrade|user|vnc|volgroup|xconfig|zerombr|zfcp)\b" 1:keyword
addhl -group /kickstart/code regex '(--[\w-]+=? ?)([^-"\n][^\h\n]*)?' 1:attribute 2:string
addhl -group /kickstart/code regex '%(include|ksappend)\>' 0:keyword
addhl -group /kickstart/code regex '%(include|ksappend)\b' 0:keyword
addhl -group /kickstart/comment fill comment
addhl -group /kickstart/single_string fill string
@ -19,10 +19,10 @@ addhl -group /kickstart/double_string fill string
addhl -group /kickstart/packages regex "^\h*[\w-]*" 0:value
addhl -group /kickstart/packages regex "#[^\n]*" 0:comment
addhl -group /kickstart/packages regex "^\h*@\^?[\h\w-]*" 0:attribute
addhl -group /kickstart/packages regex '\`\h*\K%packages\>' 0:type
addhl -group /kickstart/packages regex '^\h*%end\>' 0:type
addhl -group /kickstart/shell regex '\`\h*\K%(pre-install|pre|post)\>' 0:type
addhl -group /kickstart/shell regex '^\h*%end\>' 0:type
addhl -group /kickstart/packages regex '\`\h*\K%packages\b' 0:type
addhl -group /kickstart/packages regex '^\h*%end\b' 0:type
addhl -group /kickstart/shell regex '\`\h*\K%(pre-install|pre|post)\b' 0:type
addhl -group /kickstart/shell regex '^\h*%end\b' 0:type
addhl -group /kickstart/shell ref sh

View File

@ -20,9 +20,9 @@ addhl -group / regions -default content latex \
addhl -group /latex/comment fill comment
# Scopes, starting with a backslash
addhl -group /latex/content regex '\\\w+\>' 0:keyword
addhl -group /latex/content regex '\\\w+\b' 0:keyword
# Options passed to scopes, between brackets
addhl -group /latex/content regex '\\\w+\>\[([^]]+)\]' 1:value
addhl -group /latex/content regex '\\\w+\b\[([^]]+)\]' 1:value
# Content between dollar signs/pairs
addhl -group /latex/content regex '\$\$?[^$]+\$\$?' 0:magenta
# Emphasized text

View File

@ -31,7 +31,7 @@ addhl -group /moon/single_string fill string
addhl -group /moon/comment fill comment
addhl -group /moon/code regex ([.\\](?=[A-Za-z]\w*))|(\b[A-Za-z]\w*:)|(\b[A-Za-z]\w*\K!+)|(\W\K[@:][A-Za-z]\w*) 0:identifier
addhl -group /moon/code regex \<(and|break|catch|class|continue|do|else(if)?|export|extends|false|finally|for|from|if|import|in|local|nil|not|or|return|super|switch|then|true|try|unless|using|when|while|with)\> 0:keyword
addhl -group /moon/code regex \b(and|break|catch|class|continue|do|else(if)?|export|extends|false|finally|for|from|if|import|in|local|nil|not|or|return|super|switch|then|true|try|unless|using|when|while|with)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -27,7 +27,7 @@ addhl -group / regions -default code pug \
single_string "'" (?:(?<!\\)(\\\\)*'|$) '' \
comment // $ '' \
attribute \( \) \( \
puglang ^\h*\<(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin)\> $ '' \
puglang ^\h*\b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin)\b $ '' \
# Filters
# ‾‾‾‾‾‾‾
@ -38,7 +38,7 @@ addhl -group /pug/comment fill comment
addhl -group /pug/javascript ref javascript
addhl -group /pug/attribute ref javascript
addhl -group /pug/puglang ref javascript
addhl -group /pug/puglang regex \<(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin|of|in)\> 0:keyword
addhl -group /pug/puglang regex \b(\block|extends|include|append|prepend|if|unless|else|case|when|default|each|while|mixin|of|in)\b 0:keyword
addhl -group /pug/attribute regex [()=] 0:operator
addhl -group /pug/text regex \h*(\|) 1:meta
addhl -group /pug/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*) 1:type

View File

@ -25,10 +25,10 @@ addhl -group / regions -default code ragel \
addhl -group /ragel/string fill string
addhl -group /ragel/comment fill comment
addhl -group /ragel/code regex \<(true|false)\> 0:value
addhl -group /ragel/code regex \b(true|false)\b 0:value
addhl -group /ragel/code regex '%%\{|\}%%|<\w+>' 0:identifier
addhl -group /ragel/code regex :=|=>|->|:>|:>>|<: 0:operator
addhl -group /ragel/code regex \<(action|alnum|alpha|any|ascii|case|cntrl|contained|context|data|digit|empty|eof|err|error|exec|export|exports|extend|fblen|fbreak|fbuf|fc|fcall|fcurs|fentry|fexec|fgoto|fhold|first_final|fnext|fpc|fret|from|fstack|ftargs|graph|import|include|init|inwhen|lerr|lower|machine|nocs|noend|noerror|nofinal|noprefix|outwhen|postpop|prepush|print|punct|range|space|start|to|upper|when|write|xdigit|zlen)\> 0:keyword
addhl -group /ragel/code regex \b(action|alnum|alpha|any|ascii|case|cntrl|contained|context|data|digit|empty|eof|err|error|exec|export|exports|extend|fblen|fbreak|fbuf|fc|fcall|fcurs|fentry|fexec|fgoto|fhold|first_final|fnext|fpc|fret|from|fstack|ftargs|graph|import|include|init|inwhen|lerr|lower|machine|nocs|noend|noerror|nofinal|noprefix|outwhen|postpop|prepush|print|punct|range|space|start|to|upper|when|write|xdigit|zlen)\b 0:keyword
# Commands
# ‾‾‾‾‾‾‾‾

View File

@ -19,12 +19,12 @@ addhl -group / regions -default code tupfile \
addhl -group /tupfile/string fill string
addhl -group /tupfile/comment fill comment
addhl -group /tupfile/code regex "\%[fbBeoOdg]\>" 0:value
addhl -group /tupfile/code regex "\%[fbBeoOdg]\b" 0:value
addhl -group /tupfile/code regex "\$\([\w_]+\)" 0:value
addhl -group /tupfile/code regex ":\s*(foreach)\>" 1:keyword
addhl -group /tupfile/code regex "(\.gitignore\>)" 0:keyword
addhl -group /tupfile/code regex "\<ifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export\>" 0:keyword
addhl -group /tupfile/code regex "\<(\&?[\w_]+)\s*[:+]?=" 1:keyword
addhl -group /tupfile/code regex ":\s*(foreach)\b" 1:keyword
addhl -group /tupfile/code regex "(\.gitignore\b)" 0:keyword
addhl -group /tupfile/code regex "\bifn?eq|ifn?def|else|endif|error|include|include_rules|run|preload|export\b" 0:keyword
addhl -group /tupfile/code regex "\b(\&?[\w_]+)\s*[:+]?=" 1:keyword
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾