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