File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
crates/oxc_parser/src/lexer Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -206,18 +206,21 @@ impl<'a> Lexer<'a> {
206206 /// * `https://mathiasbynens.be/notes/javascript-identifiers-es6`
207207 fn surrogate_pair ( & mut self ) -> Option < SurrogatePair > {
208208 let high = self . hex_4_digits ( ) ?;
209- // The first code unit of a surrogate pair is always in the range from 0xD800 to 0xDBFF, and is called a high surrogate or a lead surrogate.
209+ // The first code unit of a surrogate pair is always in the range from 0xD800 to 0xDBFF,
210+ // and is called a high surrogate or a lead surrogate.
210211 let is_pair =
211212 ( 0xD800 ..=0xDBFF ) . contains ( & high) && self . peek_2_bytes ( ) == Some ( [ b'\\' , b'u' ] ) ;
212213 if !is_pair {
213214 return Some ( SurrogatePair :: CodePoint ( high) ) ;
214215 }
215216
217+ // We checked above that next 2 chars are `\u`
216218 self . consume_2_chars ( ) ;
217219
218220 let low = self . hex_4_digits ( ) ?;
219221
220- // The second code unit of a surrogate pair is always in the range from 0xDC00 to 0xDFFF, and is called a low surrogate or a trail surrogate.
222+ // The second code unit of a surrogate pair is always in the range from 0xDC00 to 0xDFFF,
223+ // and is called a low surrogate or a trail surrogate.
221224 if !( 0xDC00 ..=0xDFFF ) . contains ( & low) {
222225 return Some ( SurrogatePair :: HighLow ( high, low) ) ;
223226 }
You can’t perform that action at this time.
0 commit comments