Skip to content

Commit

Permalink
Tidy noneOf
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleymackey committed Jan 7, 2024
1 parent 58d2365 commit 58079a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/languages/swift.js
Expand Up @@ -491,7 +491,7 @@ export default function(hljs) {
};

function noneOf(list) {
return concat("(?!", list.join("|"), ")");
return negativeLookahead(either(...list));
}

const METHODS_ONLY = [...Swift.keywords, ...Swift.builtIns];
Expand All @@ -504,7 +504,7 @@ export default function(hljs) {
keywords: KEYWORDS,
match: concat(
either(/\b/, /#/),
noneOf([...METHODS_ONLY].map(x => concat(x, TRAILING_PAREN_REGEX))),
noneOf(METHODS_ONLY.map(x => concat(x, TRAILING_PAREN_REGEX))),
FUNCTION_IDENT,
lookahead(TRAILING_PAREN_REGEX),
),
Expand Down

0 comments on commit 58079a4

Please sign in to comment.