mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
LibJS: Remove some usage of DeprecatedString usage from Lexer
This changes the filename member from DeprecatedString to String. Parser has also been updated to meet the updated Lexer interface.
This commit is contained in:
parent
cfa6b4d815
commit
3226ce3d83
3 changed files with 5 additions and 4 deletions
|
@ -24,7 +24,7 @@ HashMap<char, TokenType> Lexer::s_single_char_tokens;
|
||||||
Lexer::Lexer(StringView source, StringView filename, size_t line_number, size_t line_column)
|
Lexer::Lexer(StringView source, StringView filename, size_t line_number, size_t line_column)
|
||||||
: m_source(source)
|
: m_source(source)
|
||||||
, m_current_token(TokenType::Eof, {}, {}, {}, filename, 0, 0, 0)
|
, m_current_token(TokenType::Eof, {}, {}, {}, filename, 0, 0, 0)
|
||||||
, m_filename(filename)
|
, m_filename(String::from_utf8(filename).release_value_but_fixme_should_propagate_errors())
|
||||||
, m_line_number(line_number)
|
, m_line_number(line_number)
|
||||||
, m_line_column(line_column)
|
, m_line_column(line_column)
|
||||||
, m_parsed_identifiers(adopt_ref(*new ParsedIdentifiers))
|
, m_parsed_identifiers(adopt_ref(*new ParsedIdentifiers))
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
|
#include <AK/String.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
@ -21,7 +22,7 @@ public:
|
||||||
Token next();
|
Token next();
|
||||||
|
|
||||||
DeprecatedString const& source() const { return m_source; };
|
DeprecatedString const& source() const { return m_source; };
|
||||||
DeprecatedString const& filename() const { return m_filename; };
|
String const& filename() const { return m_filename; };
|
||||||
|
|
||||||
void disallow_html_comments() { m_allow_html_comments = false; };
|
void disallow_html_comments() { m_allow_html_comments = false; };
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ private:
|
||||||
char m_current_char { 0 };
|
char m_current_char { 0 };
|
||||||
bool m_eof { false };
|
bool m_eof { false };
|
||||||
|
|
||||||
DeprecatedString m_filename;
|
String m_filename;
|
||||||
size_t m_line_number { 1 };
|
size_t m_line_number { 1 };
|
||||||
size_t m_line_column { 0 };
|
size_t m_line_column { 0 };
|
||||||
|
|
||||||
|
|
|
@ -409,7 +409,7 @@ Parser::ParserState::ParserState(Lexer l, Program::Type program_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
Parser::Parser(Lexer lexer, Program::Type program_type, Optional<EvalInitialState> initial_state_for_eval)
|
Parser::Parser(Lexer lexer, Program::Type program_type, Optional<EvalInitialState> initial_state_for_eval)
|
||||||
: m_source_code(SourceCode::create(String::from_deprecated_string(lexer.filename()).release_value_but_fixme_should_propagate_errors(), String::from_deprecated_string(lexer.source()).release_value_but_fixme_should_propagate_errors()))
|
: m_source_code(SourceCode::create(lexer.filename(), String::from_deprecated_string(lexer.source()).release_value_but_fixme_should_propagate_errors()))
|
||||||
, m_state(move(lexer), program_type)
|
, m_state(move(lexer), program_type)
|
||||||
, m_program_type(program_type)
|
, m_program_type(program_type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue