|
@@ -59,12 +59,26 @@ struct Hunk {
|
|
Vector<Line> lines;
|
|
Vector<Line> lines;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+enum class Format {
|
|
|
|
+ Unified,
|
|
|
|
+ Unknown,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+struct Header {
|
|
|
|
+ Format format { Format::Unknown };
|
|
|
|
+
|
|
|
|
+ String old_file_path;
|
|
|
|
+ String new_file_path;
|
|
|
|
+};
|
|
|
|
+
|
|
class Parser : public GenericLexer {
|
|
class Parser : public GenericLexer {
|
|
public:
|
|
public:
|
|
using GenericLexer::GenericLexer;
|
|
using GenericLexer::GenericLexer;
|
|
|
|
|
|
ErrorOr<Vector<Hunk>> parse_hunks();
|
|
ErrorOr<Vector<Hunk>> parse_hunks();
|
|
|
|
|
|
|
|
+ ErrorOr<Header> parse_header();
|
|
|
|
+
|
|
private:
|
|
private:
|
|
Optional<HunkLocation> consume_unified_location();
|
|
Optional<HunkLocation> consume_unified_location();
|
|
bool consume_line_number(size_t& number);
|
|
bool consume_line_number(size_t& number);
|