mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-30 03:20:28 +00:00
57dc179b1f
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
39 lines
932 B
C++
39 lines
932 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include "Token.h"
|
|
#include <AK/DeprecatedString.h>
|
|
|
|
namespace Cpp {
|
|
|
|
bool Position::operator<(Position const& other) const
|
|
{
|
|
return line < other.line || (line == other.line && column < other.column);
|
|
}
|
|
bool Position::operator>(Position const& other) const
|
|
{
|
|
return !(*this < other) && !(*this == other);
|
|
}
|
|
bool Position::operator==(Position const& other) const
|
|
{
|
|
return line == other.line && column == other.column;
|
|
}
|
|
bool Position::operator<=(Position const& other) const
|
|
{
|
|
return !(*this > other);
|
|
}
|
|
|
|
DeprecatedString Token::to_deprecated_string() const
|
|
{
|
|
return DeprecatedString::formatted("{} {}:{}-{}:{} ({})", type_to_string(m_type), start().line, start().column, end().line, end().column, text());
|
|
}
|
|
|
|
DeprecatedString Token::type_as_deprecated_string() const
|
|
{
|
|
return type_to_string(m_type);
|
|
}
|
|
|
|
}
|