Skip to content

Commit

Permalink
Kotlin: make function greedy
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Jul 28, 2020
1 parent 1475d0e commit 1511299
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions components/prism-kotlin.js
Expand Up @@ -9,10 +9,14 @@
lookbehind: true
},
'function': [
RegExp(/<name>(?=\s*\()/.source.replace('<name>', functionName)),
{
pattern: RegExp(/<name>(?=\s*\()/.source.replace('<name>', functionName)),
greedy: true
},
{
pattern: RegExp(/(\.)<name>(?=\s*\{)/.source.replace('<name>', functionName)),
lookbehind: true
lookbehind: true,
greedy: true
}
],
'number': /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
Expand Down
4 changes: 3 additions & 1 deletion tests/languages/kotlin/function_feature.test
Expand Up @@ -4,6 +4,7 @@ list.filter {}
`function 1`()
` !"#$%^&()*+,=?@{|}~-_`()
list.`take 1` {}
`make fun`()

----------------------------------------------------

Expand All @@ -15,7 +16,8 @@ list.`take 1` {}
["function", "`function 1`"], ["punctuation", "("], ["punctuation", ")"],
["function", "` !\"#$%^&()*+,=?@{|}~-_`"], ["punctuation", "("], ["punctuation", ")"],
"\r\nlist", ["punctuation", "."],
["function", "`take 1`"], ["punctuation", "{"], ["punctuation", "}"]
["function", "`take 1`"], ["punctuation", "{"], ["punctuation", "}"],
["function", "`make fun`"], ["punctuation", "("], ["punctuation", ")"]
]

----------------------------------------------------
Expand Down

0 comments on commit 1511299

Please sign in to comment.