Skip to content

Commit

Permalink
Tidy noneOf
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleymackey committed Jan 13, 2024
1 parent 7fffa5e commit a0db36f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/languages/swift.js
Original file line number Diff line number Diff line change
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 a0db36f

Please sign in to comment.