Serenity Operating System
1/*
2 * Copyright (c) 2020, the SerenityOS developers.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include "Token.h"
8#include <AK/DeprecatedString.h>
9
10namespace Cpp {
11
12bool Position::operator<(Position const& other) const
13{
14 return line < other.line || (line == other.line && column < other.column);
15}
16bool Position::operator>(Position const& other) const
17{
18 return !(*this < other) && !(*this == other);
19}
20bool Position::operator==(Position const& other) const
21{
22 return line == other.line && column == other.column;
23}
24bool Position::operator<=(Position const& other) const
25{
26 return !(*this > other);
27}
28
29DeprecatedString Token::to_deprecated_string() const
30{
31 return DeprecatedString::formatted("{} {}:{}-{}:{} ({})", type_to_string(m_type), start().line, start().column, end().line, end().column, text());
32}
33
34DeprecatedString Token::type_as_deprecated_string() const
35{
36 return type_to_string(m_type);
37}
38
39}