-
Notifications
You must be signed in to change notification settings - Fork 1
/
loc.h
45 lines (38 loc) · 962 Bytes
/
loc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef LIB_RUBY_PARSER_LOC_H
#define LIB_RUBY_PARSER_LOC_H
#include <stddef.h>
#include <stdint.h>
#include "decoded_input.h"
/// @defgroup loc Loc
/// @brief A set of structs and functions to work with source locations
/// @{
/// @}
/// `Loc` struct from `lib-ruby-parser`
/// @ingroup loc
typedef struct
{
/// Begin of the location
size_t begin;
/// End of the location
size_t end;
} LIB_RUBY_PARSER_Loc;
/// Returns source code of the given location.
/// Equivalent of `lib_ruby_parser::Loc::source`
/// @ingroup loc
char *LIB_RUBY_PARSER_loc_source(const LIB_RUBY_PARSER_Loc *loc, const LIB_RUBY_PARSER_DecodedInput *input);
/// Equivalent of `Option<Loc>`
/// @ingroup loc
typedef struct
{
enum
{
LIB_RUBY_PARSER_NONE_LOC = 0,
LIB_RUBY_PARSER_SOME_LOC = 1,
} tag;
union
{
LIB_RUBY_PARSER_Loc loc;
uint8_t none;
} as;
} LIB_RUBY_PARSER_MaybeLoc;
#endif // LIB_RUBY_PARSER_LOC_H