mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Restore highlighting of all keywords, functions, etc.
Short explanation on phab. Ace stops at the first regex match, so we must use a function to specify the token type. Bug: T219593 Change-Id: If7e6e98de81ce7e1be334732518425c8115e4aea
This commit is contained in:
parent
7f5b3dd23e
commit
c73d5b5bde
|
@ -13,7 +13,8 @@ ace.define( 'ace/mode/abusefilter_highlight_rules', [ 'require', 'exports', 'mod
|
|||
'support.function': cfg.functions,
|
||||
'constant.language': constants
|
||||
},
|
||||
'identifier'
|
||||
// Null as default used in isKeywordOrVariable
|
||||
null
|
||||
),
|
||||
variables = this.createKeywordMapper(
|
||||
{
|
||||
|
@ -24,6 +25,13 @@ ace.define( 'ace/mode/abusefilter_highlight_rules', [ 'require', 'exports', 'mod
|
|||
'identifier',
|
||||
true
|
||||
),
|
||||
isKeywordOrVariable = function ( value ) {
|
||||
if ( keywords( value ) !== null ) {
|
||||
return keywords( value );
|
||||
} else {
|
||||
return variables( value );
|
||||
}
|
||||
},
|
||||
integer = '(?:(?:[1-9]\\d*)|(?:0))',
|
||||
fraction = '(?:\\.\\d+)',
|
||||
intPart = '(?:\\d+)',
|
||||
|
@ -50,10 +58,7 @@ ace.define( 'ace/mode/abusefilter_highlight_rules', [ 'require', 'exports', 'mod
|
|||
token: 'constant.numeric',
|
||||
regex: integer + '\\b'
|
||||
}, {
|
||||
token: variables,
|
||||
regex: '[a-zA-Z_][a-zA-Z0-9_]*\\b'
|
||||
}, {
|
||||
token: keywords,
|
||||
token: isKeywordOrVariable,
|
||||
regex: '[a-zA-Z_][a-zA-Z0-9_]*\\b'
|
||||
}, {
|
||||
token: 'keyword.operator',
|
||||
|
|
Loading…
Reference in a new issue