Use non-nestable values as keys for O(1) lookup

This commit is contained in:
Aidan Woods 2018-04-08 20:38:21 +01:00
parent 90ad738933
commit 70f5c02d47
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
1 changed files with 3 additions and 1 deletions

View File

@ -1114,6 +1114,8 @@ class Parsedown
{
$Elements = array();
$nonNestables = array_combine($nonNestables, $nonNestables);
# $excerpt is based on the first occurrence of a marker
while ($excerpt = strpbrk($text, $this->inlineMarkerList))
@ -1128,7 +1130,7 @@ class Parsedown
{
# check to see if the current inline type is nestable in the current context
if ( ! empty($nonNestables) and in_array($inlineType, $nonNestables))
if (isset($nonNestables[$inlineType]))
{
continue;
}