@@ -62,36 +62,35 @@ public function getParsedContents()
62
62
if (null === $ this ->parsedContents ) {
63
63
$ this ->parsedContents = preg_split (
64
64
'/\{
65
- # We want the whole tag line, but without the inline tag
66
- # delimiters.
65
+ # "{@}" is not a valid inline tag. This ensures that
66
+ # we do not treat it as one, but treat it literally.
67
+ (?!@\})
68
+ # We want to capture the whole tag line, but without the
69
+ # inline tag delimiters.
67
70
(\@
68
- # The content should not be captured, or it will appear
69
- # in the result separately.
71
+ # Match everything up to the next delimiter.
72
+ [^{}]*
73
+ # Nested inline tag content should not be captured, or
74
+ # it will appear in the result separately.
70
75
(?:
71
76
# Match nested inline tags.
72
- # Because we did not catch the tag delimiters
73
- # earlier, we must be explicit with them here.
74
- # Notice that this also matches "{}", as a way to
75
- # later introduce it as an escape sequence.
76
- \{(?1)?\}
77
- |
78
- # "{@}" is not a valid inline tag. This ensures that
79
- # having it occur inside an inline tag does not trip
80
- # us up. While this is required in any event, notice
81
- # that this is also later an escape sequence.
82
- \{\@\}
83
- |
84
- # If we are not dealing with a nested inline tag,
85
- # get the character, as long as it is not a closing
86
- # tag delimiter.
87
- # This is an alternative way of non-greedy matching.
88
- [^\}]
89
- )+ # We need to keep doing these checks for every
90
- # character, since we never know where an inline tag
91
- # is going to start at. The "+" ensures we are not
92
- # treating "{@}" as a valid inline tag.
77
+ (?:
78
+ # Because we did not catch the tag delimiters
79
+ # earlier, we must be explicit with them here.
80
+ # Notice that this also matches "{}", as a way
81
+ # to later introduce it as an escape sequence.
82
+ \{(?1)?\}
83
+ |
84
+ # Make sure we match hanging "{".
85
+ \{
86
+ )
87
+ # Match content after the nested inline tag.
88
+ [^{}]*
89
+ )* # If there are more inline tags, match them as well.
90
+ # We use "*" since there may not be any nested inline
91
+ # tags.
93
92
)
94
- \}/xuS ' ,
93
+ \}/Sux ' ,
95
94
$ this ->contents ,
96
95
null ,
97
96
PREG_SPLIT_DELIM_CAPTURE
0 commit comments