2020-12-28 20:15:22 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-12-28 20:15:22 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Types.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
struct Position {
|
|
|
|
size_t line { 0 };
|
|
|
|
size_t column { 0 };
|
2021-07-10 23:46:17 +03:00
|
|
|
size_t offset { 0 };
|
2020-12-28 20:15:22 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SourceRange {
|
2021-07-10 23:46:17 +03:00
|
|
|
[[nodiscard]] bool contains(Position const& position) const { return position.offset <= end.offset && position.offset >= start.offset; }
|
|
|
|
|
2021-02-28 12:42:34 +03:00
|
|
|
StringView filename;
|
2020-12-28 20:15:22 +03:00
|
|
|
Position start;
|
|
|
|
Position end;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|