| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* |
|
2
|
|
|
|
|
|
|
* Copyright (C) the libgit2 contributors. All rights reserved. |
|
3
|
|
|
|
|
|
|
* |
|
4
|
|
|
|
|
|
|
* This file is part of libgit2, distributed under the GNU GPL v2 with |
|
5
|
|
|
|
|
|
|
* a Linking Exception. For full terms see the included COPYING file. |
|
6
|
|
|
|
|
|
|
*/ |
|
7
|
|
|
|
|
|
|
#ifndef INCLUDE_parse_h__ |
|
8
|
|
|
|
|
|
|
#define INCLUDE_parse_h__ |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "common.h" |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
typedef struct { |
|
13
|
|
|
|
|
|
|
/* Original content buffer */ |
|
14
|
|
|
|
|
|
|
const char *content; |
|
15
|
|
|
|
|
|
|
size_t content_len; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
/* The remaining (unparsed) buffer */ |
|
18
|
|
|
|
|
|
|
const char *remain; |
|
19
|
|
|
|
|
|
|
size_t remain_len; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
const char *line; |
|
22
|
|
|
|
|
|
|
size_t line_len; |
|
23
|
|
|
|
|
|
|
size_t line_num; |
|
24
|
|
|
|
|
|
|
} git_parse_ctx; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#define GIT_PARSE_CTX_INIT { 0 } |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
int git_parse_ctx_init(git_parse_ctx *ctx, const char *content, size_t content_len); |
|
29
|
|
|
|
|
|
|
void git_parse_ctx_clear(git_parse_ctx *ctx); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#define git_parse_ctx_contains_s(ctx, str) \ |
|
32
|
|
|
|
|
|
|
git_parse_ctx_contains(ctx, str, sizeof(str) - 1) |
|
33
|
|
|
|
|
|
|
|
|
34
|
40
|
|
|
|
|
|
GIT_INLINE(bool) git_parse_ctx_contains( |
|
35
|
|
|
|
|
|
|
git_parse_ctx *ctx, const char *str, size_t len) |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
40
|
100
|
|
|
|
|
return (ctx->line_len >= len && memcmp(ctx->line, str, len) == 0); |
|
|
|
100
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
void git_parse_advance_line(git_parse_ctx *ctx); |
|
41
|
|
|
|
|
|
|
void git_parse_advance_chars(git_parse_ctx *ctx, size_t char_cnt); |
|
42
|
|
|
|
|
|
|
int git_parse_advance_expected( |
|
43
|
|
|
|
|
|
|
git_parse_ctx *ctx, |
|
44
|
|
|
|
|
|
|
const char *expected, |
|
45
|
|
|
|
|
|
|
size_t expected_len); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#define git_parse_advance_expected_str(ctx, str) \ |
|
48
|
|
|
|
|
|
|
git_parse_advance_expected(ctx, str, strlen(str)) |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
int git_parse_advance_ws(git_parse_ctx *ctx); |
|
51
|
|
|
|
|
|
|
int git_parse_advance_nl(git_parse_ctx *ctx); |
|
52
|
|
|
|
|
|
|
int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base); |
|
53
|
|
|
|
|
|
|
int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
enum GIT_PARSE_PEEK_FLAGS { |
|
56
|
|
|
|
|
|
|
GIT_PARSE_PEEK_SKIP_WHITESPACE = (1 << 0) |
|
57
|
|
|
|
|
|
|
}; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
int git_parse_peek(char *out, git_parse_ctx *ctx, int flags); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#endif |