Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 5fb285c0d0e3 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
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 } |