This repository was archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtoken_rewriter.h
More file actions
50 lines (43 loc) · 1.42 KB
/
token_rewriter.h
File metadata and controls
50 lines (43 loc) · 1.42 KB
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
46
47
48
49
50
#ifndef LIB_RUBY_PARSER_TOKEN_REWRITER_H
#define LIB_RUBY_PARSER_TOKEN_REWRITER_H
#include <stdint.h>
#include <stdbool.h>
#include "token.h"
#include "shared_byte_list.h"
typedef enum
{
LIB_RUBY_PARSER_REWRITE_ACTION_DROP,
LIB_RUBY_PARSER_REWRITE_ACTION_KEEP
} LIB_RUBY_PARSER_RewriteAction;
typedef struct
{
enum
{
LIB_RUBY_PARSER_LEX_STATE_SET,
LIB_RUBY_PARSER_LEX_STATE_KEEP
} tag;
union
{
int32_t set;
} as;
} LIB_RUBY_PARSER_LexStateAction;
typedef struct
{
LIB_RUBY_PARSER_Token *rewritten_token;
LIB_RUBY_PARSER_RewriteAction token_action;
LIB_RUBY_PARSER_LexStateAction lex_state_action;
} LIB_RUBY_PARSER_TokenRewriterResult;
void LIB_RUBY_PARSER_drop_token_rewriter_result(LIB_RUBY_PARSER_TokenRewriterResult *);
typedef LIB_RUBY_PARSER_TokenRewriterResult (*LIB_RUBY_PARSER_TokenRewriter_Function)(void *state, LIB_RUBY_PARSER_Token *token, LIB_RUBY_PARSER_SharedByteList input);
typedef struct
{
LIB_RUBY_PARSER_TokenRewriter_Function f;
void *state;
} LIB_RUBY_PARSER_TokenRewriter;
typedef struct
{
LIB_RUBY_PARSER_TokenRewriter token_rewriter;
} LIB_RUBY_PARSER_MaybeTokenRewriter;
bool LIB_RUBY_PARSER_maybe_token_rewriter_is_some(const LIB_RUBY_PARSER_MaybeTokenRewriter *maybe_token_rewriter);
bool LIB_RUBY_PARSER_maybe_token_rewriter_is_none(const LIB_RUBY_PARSER_MaybeTokenRewriter *maybe_token_rewriter);
#endif // LIB_RUBY_PARSER_TOKEN_REWRITER_H