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