Mercurial > hg > cmmr2012-drupal-site
comparison vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
132 return chr(($num>>18) + 0xF0) . chr((($num>>12)&0x3F) + 0x80) | 132 return chr(($num>>18) + 0xF0) . chr((($num>>12)&0x3F) + 0x80) |
133 . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); | 133 . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); |
134 } | 134 } |
135 throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); | 135 throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); |
136 } | 136 } |
137 | |
138 /** | |
139 * @internal | |
140 * | |
141 * Parses a constant doc string. | |
142 * | |
143 * @param string $startToken Doc string start token content (<<<SMTHG) | |
144 * @param string $str String token content | |
145 * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes | |
146 * | |
147 * @return string Parsed string | |
148 */ | |
149 public static function parseDocString(string $startToken, string $str, bool $parseUnicodeEscape = true) : string { | |
150 // strip last newline (thanks tokenizer for sticking it into the string!) | |
151 $str = preg_replace('~(\r\n|\n|\r)\z~', '', $str); | |
152 | |
153 // nowdoc string | |
154 if (false !== strpos($startToken, '\'')) { | |
155 return $str; | |
156 } | |
157 | |
158 return self::parseEscapeSequences($str, null, $parseUnicodeEscape); | |
159 } | |
160 | 137 |
161 public function getType() : string { | 138 public function getType() : string { |
162 return 'Scalar_String'; | 139 return 'Scalar_String'; |
163 } | 140 } |
164 } | 141 } |