public function read_name() { $backslash = false; $name = ''; while (($ch = $this->peek()) !== null) { if (!$backslash) { if ($ch == '//') { $backslash = true; $this->next(); } elseif (ParseJS::is_identifier_char($ch)) { $name .= $this->next(); } else { break; } } else { if ($ch != 'u') { return $this->parse_error('Expecting UnicodeEscapeSequence -- uXXXX'); } $ch = $this->read_escaped_char(); if (!ParseJS::is_identifier_char($ch)) { return $this->parse_error('Unicode char: ' . ParseJS::uniord($ch) . ' is not valid in identifier'); } $name .= $ch; $backslash = false; } } return $name; }