Rizin
unix-like reverse engineering framework and cli tools
mpc.h
Go to the documentation of this file.
1 /*
2 ** mpc - Micro Parser Combinator library for C
3 **
4 ** https://github.com/orangeduck/mpc
5 **
6 ** Daniel Holden - contact@daniel-holden.com
7 ** Licensed under BSD3
8 */
9 
10 #ifndef mpc_h
11 #define mpc_h
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #include <stdlib.h>
18 #include <stdio.h>
19 #include <stdarg.h>
20 #include <string.h>
21 #include <math.h>
22 #include <errno.h>
23 #include <ctype.h>
24 
25 /*
26 ** State Type
27 */
28 
29 typedef struct {
30  long pos;
31  long row;
32  long col;
33  int term;
34 } mpc_state_t;
35 
36 /*
37 ** Error Type
38 */
39 
40 typedef struct {
43  char *filename;
44  char *failure;
45  char **expected;
46  char received;
47 } mpc_err_t;
48 
50 char *mpc_err_string(mpc_err_t *e);
53 
54 /*
55 ** Parsing
56 */
57 
58 typedef void mpc_val_t;
59 
60 typedef union {
63 } mpc_result_t;
64 
65 struct mpc_parser_t;
66 typedef struct mpc_parser_t mpc_parser_t;
67 
68 int mpc_parse(const char *filename, const char *string, mpc_parser_t *p, mpc_result_t *r);
69 int mpc_nparse(const char *filename, const char *string, size_t length, mpc_parser_t *p, mpc_result_t *r);
73 
74 /*
75 ** Function Types
76 */
77 
78 typedef void(*mpc_dtor_t)(mpc_val_t*);
79 typedef mpc_val_t*(*mpc_ctor_t)(void);
80 
81 typedef mpc_val_t*(*mpc_apply_t)(mpc_val_t*);
82 typedef mpc_val_t*(*mpc_apply_to_t)(mpc_val_t*,void*);
83 typedef mpc_val_t*(*mpc_fold_t)(int,mpc_val_t**);
84 
85 typedef int(*mpc_check_t)(mpc_val_t**);
86 typedef int(*mpc_check_with_t)(mpc_val_t**,void*);
87 
88 /*
89 ** Building a Parser
90 */
91 
92 mpc_parser_t *mpc_new(const char *name);
96 
98 void mpc_cleanup(int n, ...);
99 
100 /*
101 ** Basic Parsers
102 */
103 
104 mpc_parser_t *mpc_any(void);
105 mpc_parser_t *mpc_char(char c);
106 mpc_parser_t *mpc_range(char s, char e);
107 mpc_parser_t *mpc_oneof(const char *s);
108 mpc_parser_t *mpc_noneof(const char *s);
109 mpc_parser_t *mpc_satisfy(int(*f)(char));
110 mpc_parser_t *mpc_string(const char *s);
111 
112 /*
113 ** Other Parsers
114 */
115 
116 mpc_parser_t *mpc_pass(void);
117 mpc_parser_t *mpc_fail(const char *m);
118 mpc_parser_t *mpc_failf(const char *fmt, ...);
121 mpc_parser_t *mpc_anchor(int(*f)(char,char));
122 mpc_parser_t *mpc_state(void);
123 
124 /*
125 ** Combinator Parsers
126 */
127 
128 mpc_parser_t *mpc_expect(mpc_parser_t *a, const char *e);
129 mpc_parser_t *mpc_expectf(mpc_parser_t *a, const char *fmt, ...);
134 mpc_parser_t *mpc_checkf(mpc_parser_t *a, mpc_dtor_t da, mpc_check_t f, const char *fmt, ...);
135 mpc_parser_t *mpc_check_withf(mpc_parser_t *a, mpc_dtor_t da, mpc_check_with_t f, void *x, const char *fmt, ...);
136 
141 
145 
146 mpc_parser_t *mpc_or(int n, ...);
147 mpc_parser_t *mpc_and(int n, mpc_fold_t f, ...);
148 
150 
151 /*
152 ** Common Parsers
153 */
154 
155 mpc_parser_t *mpc_eoi(void);
156 mpc_parser_t *mpc_soi(void);
157 
160 
163 mpc_parser_t *mpc_blank(void);
164 
166 mpc_parser_t *mpc_tab(void);
167 mpc_parser_t *mpc_escape(void);
168 
169 mpc_parser_t *mpc_digit(void);
172 mpc_parser_t *mpc_digits(void);
175 
176 mpc_parser_t *mpc_lower(void);
177 mpc_parser_t *mpc_upper(void);
178 mpc_parser_t *mpc_alpha(void);
181 
182 mpc_parser_t *mpc_int(void);
183 mpc_parser_t *mpc_hex(void);
184 mpc_parser_t *mpc_oct(void);
185 mpc_parser_t *mpc_number(void);
186 
187 mpc_parser_t *mpc_real(void);
188 mpc_parser_t *mpc_float(void);
189 
193 
194 mpc_parser_t *mpc_ident(void);
195 
196 /*
197 ** Useful Parsers
198 */
199 
203 
208 mpc_parser_t *mpc_sym(const char *s);
210 
211 mpc_parser_t *mpc_between(mpc_parser_t *a, mpc_dtor_t ad, const char *o, const char *c);
216 
217 mpc_parser_t *mpc_tok_between(mpc_parser_t *a, mpc_dtor_t ad, const char *o, const char *c);
222 
223 /*
224 ** Common Function Parameters
225 */
226 
227 void mpcf_dtor_null(mpc_val_t *x);
228 
230 mpc_val_t *mpcf_ctor_str(void);
231 
240 
245 
250 
251 mpc_val_t *mpcf_null(int n, mpc_val_t** xs);
252 mpc_val_t *mpcf_fst(int n, mpc_val_t** xs);
253 mpc_val_t *mpcf_snd(int n, mpc_val_t** xs);
254 mpc_val_t *mpcf_trd(int n, mpc_val_t** xs);
255 
256 mpc_val_t *mpcf_fst_free(int n, mpc_val_t** xs);
257 mpc_val_t *mpcf_snd_free(int n, mpc_val_t** xs);
258 mpc_val_t *mpcf_trd_free(int n, mpc_val_t** xs);
259 mpc_val_t *mpcf_all_free(int n, mpc_val_t** xs);
260 
262 mpc_val_t *mpcf_strfold(int n, mpc_val_t** xs);
263 mpc_val_t *mpcf_maths(int n, mpc_val_t** xs);
264 
265 /*
266 ** Regular Expression Parsers
267 */
268 
269 enum {
271  MPC_RE_M = 1,
272  MPC_RE_S = 2,
274  MPC_RE_DOTALL = 2
275 };
276 
277 mpc_parser_t *mpc_re(const char *re);
278 mpc_parser_t *mpc_re_mode(const char *re, int mode);
279 
280 /*
281 ** AST
282 */
283 
284 typedef struct mpc_ast_t {
285  char *tag;
286  char *contents;
289  struct mpc_ast_t** children;
291 
292 mpc_ast_t *mpc_ast_new(const char *tag, const char *contents);
293 mpc_ast_t *mpc_ast_build(int n, const char *tag, ...);
296 mpc_ast_t *mpc_ast_add_tag(mpc_ast_t *a, const char *t);
297 mpc_ast_t *mpc_ast_add_root_tag(mpc_ast_t *a, const char *t);
298 mpc_ast_t *mpc_ast_tag(mpc_ast_t *a, const char *t);
300 
301 void mpc_ast_delete(mpc_ast_t *a);
302 void mpc_ast_print(mpc_ast_t *a);
303 void mpc_ast_print_to(mpc_ast_t *a, FILE *fp);
304 
305 int mpc_ast_get_index(mpc_ast_t *ast, const char *tag);
306 int mpc_ast_get_index_lb(mpc_ast_t *ast, const char *tag, int lb);
307 mpc_ast_t *mpc_ast_get_child(mpc_ast_t *ast, const char *tag);
308 mpc_ast_t *mpc_ast_get_child_lb(mpc_ast_t *ast, const char *tag, int lb);
309 
310 typedef enum {
314 
315 typedef struct mpc_ast_trav_t {
321 
324 
326 
328 
329 /*
330 ** Warning: This function currently doesn't test for equality of the `state` member!
331 */
333 
334 mpc_val_t *mpcf_fold_ast(int n, mpc_val_t **as);
336 mpc_val_t *mpcf_state_ast(int n, mpc_val_t **xs);
337 
338 mpc_parser_t *mpca_tag(mpc_parser_t *a, const char *t);
339 mpc_parser_t *mpca_add_tag(mpc_parser_t *a, const char *t);
343 
346 
350 
351 mpc_parser_t *mpca_or(int n, ...);
352 mpc_parser_t *mpca_and(int n, ...);
353 
354 enum {
358 };
359 
360 mpc_parser_t *mpca_grammar(int flags, const char *grammar, ...);
361 
362 mpc_err_t *mpca_lang(int flags, const char *language, ...);
363 mpc_err_t *mpca_lang_file(int flags, FILE *f, ...);
364 mpc_err_t *mpca_lang_pipe(int flags, FILE *f, ...);
365 mpc_err_t *mpca_lang_contents(int flags, const char *filename, ...);
366 
367 /*
368 ** Misc
369 */
370 
371 
372 void mpc_print(mpc_parser_t *p);
374 void mpc_stats(mpc_parser_t *p);
375 
376 int mpc_test_pass(mpc_parser_t *p, const char *s, const void *d,
377  int(*tester)(const void*, const void*),
378  mpc_dtor_t destructor,
379  void(*printer)(const void*));
380 
381 int mpc_test_fail(mpc_parser_t *p, const char *s, const void *d,
382  int(*tester)(const void*, const void*),
383  mpc_dtor_t destructor,
384  void(*printer)(const void*));
385 
386 #ifdef __cplusplus
387 }
388 #endif
389 
390 #endif
#define e(frag)
#define r
Definition: crypto_rc6.c:12
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
const char * filename
Definition: ioapi.h:137
const char int mode
Definition: ioapi.h:137
void * p
Definition: libc.cpp:67
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname pipe
Definition: sflib.h:73
int x
Definition: mipsasm.c:20
int n
Definition: mipsasm.c:19
mpc_parser_t * mpc_whitespace(void)
Definition: mpc.c:2008
mpc_parser_t * mpc_define(mpc_parser_t *p, mpc_parser_t *a)
Definition: mpc.c:1580
mpc_parser_t * mpca_not(mpc_parser_t *a)
Definition: mpc.c:3281
mpc_parser_t * mpc_lift_val(mpc_val_t *x)
Definition: mpc.c:1663
void mpc_optimise(mpc_parser_t *p)
Definition: mpc.c:4064
mpc_parser_t * mpc_real(void)
Definition: mpc.c:2034
mpc_parser_t * mpc_char(char c)
Definition: mpc.c:1747
mpc_ast_t * mpc_ast_get_child(mpc_ast_t *ast, const char *tag)
Definition: mpc.c:3060
mpc_val_t *(* mpc_apply_t)(mpc_val_t *)
Definition: mpc.h:81
mpc_parser_t * mpc_re(const char *re)
Definition: mpc.c:2353
mpc_parser_t * mpca_add_tag(mpc_parser_t *a, const char *t)
Definition: mpc.c:3273
mpc_err_t * mpca_lang(int flags, const char *language,...)
Definition: mpc.c:3790
mpc_parser_t * mpc_noneof(const char *s)
Definition: mpc.c:1770
mpc_parser_t * mpc_escape(void)
Definition: mpc.c:2014
char * mpc_err_string(mpc_err_t *e)
Definition: mpc.c:630
mpc_val_t * mpcf_trd(int n, mpc_val_t **xs)
Definition: mpc.c:2627
mpc_parser_t * mpc_fail(const char *m)
Definition: mpc.c:1616
mpc_parser_t * mpc_undefine(mpc_parser_t *p)
Definition: mpc.c:1574
void mpcf_dtor_null(mpc_val_t *x)
Definition: mpc.c:2428
mpc_parser_t * mpc_check_withf(mpc_parser_t *a, mpc_dtor_t da, mpc_check_with_t f, void *x, const char *fmt,...)
Definition: mpc.c:1854
mpc_ast_t * mpc_ast_get_child_lb(mpc_ast_t *ast, const char *tag, int lb)
Definition: mpc.c:3064
mpc_val_t * mpcf_float(mpc_val_t *x)
Definition: mpc.c:2455
mpc_parser_t * mpc_brackets(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2101
mpc_val_t * mpcf_hex(mpc_val_t *x)
Definition: mpc.c:2441
mpc_parser_t * mpc_check_with(mpc_parser_t *a, mpc_dtor_t da, mpc_check_with_t f, void *x, const char *e)
Definition: mpc.c:1826
mpc_parser_t * mpc_lift(mpc_ctor_t f)
Definition: mpc.c:1670
mpc_val_t * mpcf_ctor_str(void)
Definition: mpc.c:2431
mpc_parser_t * mpc_upper(void)
Definition: mpc.c:2024
mpc_parser_t * mpc_string(const char *s)
Definition: mpc.c:1786
mpc_parser_t * mpca_and(int n,...)
Definition: mpc.c:3308
mpc_parser_t * mpc_hex(void)
Definition: mpc.c:2030
void mpc_err_delete(mpc_err_t *e)
Definition: mpc.c:575
mpc_val_t * mpcf_ctor_null(void)
Definition: mpc.c:2430
mpc_parser_t * mpc_braces(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2100
mpc_ast_trav_order_t
Definition: mpc.h:310
@ mpc_ast_trav_order_pre
Definition: mpc.h:311
@ mpc_ast_trav_order_post
Definition: mpc.h:312
mpc_val_t *(* mpc_fold_t)(int, mpc_val_t **)
Definition: mpc.h:83
mpc_parser_t * mpc_parens(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2099
mpc_parser_t * mpc_tok_parens(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2110
mpc_parser_t * mpc_string_lit(void)
Definition: mpc.c:2060
void mpc_ast_delete(mpc_ast_t *a)
Definition: mpc.c:2886
mpc_parser_t * mpc_failf(const char *fmt,...)
Definition: mpc.c:1644
mpc_parser_t * mpc_copy(mpc_parser_t *a)
Definition: mpc.c:1488
mpc_parser_t * mpca_root(mpc_parser_t *a)
Definition: mpc.c:3277
int mpc_parse_pipe(const char *filename, FILE *pipe, mpc_parser_t *p, mpc_result_t *r)
Definition: mpc.c:1345
mpc_parser_t * mpc_digit(void)
Definition: mpc.c:2016
mpc_parser_t * mpc_oneof(const char *s)
Definition: mpc.c:1762
mpc_ast_t * mpc_ast_new(const char *tag, const char *contents)
Definition: mpc.c:2910
mpc_parser_t * mpc_blank(void)
Definition: mpc.c:2010
void mpc_ast_print(mpc_ast_t *a)
Definition: mpc.c:3036
mpc_ast_t * mpc_ast_tag(mpc_ast_t *a, const char *t)
Definition: mpc.c:2998
mpc_val_t * mpcf_freefold(int n, mpc_val_t **xs)
mpc_val_t * mpcf_unescape(mpc_val_t *x)
Definition: mpc.c:2582
mpc_val_t * mpcf_fold_ast(int n, mpc_val_t **as)
Definition: mpc.c:3212
mpc_val_t * mpcf_strtrimr(mpc_val_t *x)
Definition: mpc.c:2470
mpc_parser_t * mpc_ident(void)
Definition: mpc.c:2070
mpc_parser_t * mpc_boundary_newline(void)
Definition: mpc.c:2006
int(* mpc_check_with_t)(mpc_val_t **, void *)
Definition: mpc.h:86
mpc_parser_t * mpc_strip(mpc_parser_t *a)
Definition: mpc.c:2087
mpc_val_t * mpcf_maths(int n, mpc_val_t **xs)
Definition: mpc.c:2665
mpc_parser_t * mpc_apply(mpc_parser_t *a, mpc_apply_t f)
Definition: mpc.c:1798
mpc_parser_t * mpc_eoi(void)
Definition: mpc.c:1983
mpc_err_t * mpca_lang_contents(int flags, const char *filename,...)
Definition: mpc.c:3813
mpc_parser_t * mpc_int(void)
Definition: mpc.c:2029
mpc_parser_t * mpca_many(mpc_parser_t *a)
Definition: mpc.c:3283
mpc_val_t * mpcf_escape_char_raw(mpc_val_t *x)
Definition: mpc.c:2612
mpc_parser_t * mpca_maybe(mpc_parser_t *a)
Definition: mpc.c:3282
mpc_parser_t * mpc_satisfy(int(*f)(char))
Definition: mpc.c:1779
mpc_val_t * mpcf_all_free(int n, mpc_val_t **xs)
Definition: mpc.c:2640
mpc_parser_t * mpc_not(mpc_parser_t *a, mpc_dtor_t da)
Definition: mpc.c:1886
mpc_val_t * mpcf_oct(mpc_val_t *x)
Definition: mpc.c:2448
mpc_ast_trav_t * mpc_ast_traverse_start(mpc_ast_t *ast, mpc_ast_trav_order_t order)
Definition: mpc.c:3076
int mpc_ast_get_index_lb(mpc_ast_t *ast, const char *tag, int lb)
Definition: mpc.c:3048
void mpc_stats(mpc_parser_t *p)
Definition: mpc.c:3889
int mpc_parse_contents(const char *filename, mpc_parser_t *p, mpc_result_t *r)
Definition: mpc.c:1353
mpc_parser_t * mpc_digits(void)
Definition: mpc.c:2019
mpc_parser_t * mpc_predictive(mpc_parser_t *a)
Definition: mpc.c:1870
mpc_parser_t * mpc_many(mpc_fold_t f, mpc_parser_t *a)
Definition: mpc.c:1902
mpc_parser_t * mpc_alpha(void)
Definition: mpc.c:2025
int mpc_nparse(const char *filename, const char *string, size_t length, mpc_parser_t *p, mpc_result_t *r)
Definition: mpc.c:1329
mpc_parser_t * mpc_maybe_lift(mpc_parser_t *a, mpc_ctor_t lf)
Definition: mpc.c:1890
mpc_val_t * mpcf_escape_string_raw(mpc_val_t *x)
Definition: mpc.c:2600
mpc_parser_t * mpc_total(mpc_parser_t *a, mpc_dtor_t da)
Definition: mpc.c:2091
mpc_parser_t * mpca_count(int n, mpc_parser_t *a)
Definition: mpc.c:3285
mpc_parser_t * mpc_number(void)
Definition: mpc.c:2032
int mpc_parse(const char *filename, const char *string, mpc_parser_t *p, mpc_result_t *r)
Definition: mpc.c:1321
mpc_parser_t * mpc_new(const char *name)
Definition: mpc.c:1480
mpc_parser_t * mpc_tab(void)
Definition: mpc.c:2013
mpc_err_t * mpca_lang_pipe(int flags, FILE *f,...)
Definition: mpc.c:3768
mpc_parser_t * mpc_octdigit(void)
Definition: mpc.c:2018
mpc_parser_t * mpc_any(void)
Definition: mpc.c:1741
void mpc_err_print(mpc_err_t *e)
Definition: mpc.c:584
mpc_parser_t * mpc_re_mode(const char *re, int mode)
Definition: mpc.c:2357
mpc_parser_t * mpc_newline(void)
Definition: mpc.c:2012
mpc_val_t * mpcf_snd(int n, mpc_val_t **xs)
Definition: mpc.c:2626
mpc_parser_t * mpc_between(mpc_parser_t *a, mpc_dtor_t ad, const char *o, const char *c)
Definition: mpc.c:2093
mpc_val_t * mpcf_free(mpc_val_t *x)
Definition: mpc.c:2432
void mpc_delete(mpc_parser_t *p)
Definition: mpc.c:1453
mpc_parser_t * mpc_tok_between(mpc_parser_t *a, mpc_dtor_t ad, const char *o, const char *c)
Definition: mpc.c:2104
mpc_parser_t * mpc_not_lift(mpc_parser_t *a, mpc_dtor_t da, mpc_ctor_t lf)
Definition: mpc.c:1877
mpc_parser_t * mpc_check(mpc_parser_t *a, mpc_dtor_t da, mpc_check_t f, const char *e)
Definition: mpc.c:1815
mpc_val_t * mpcf_strtrim(mpc_val_t *x)
Definition: mpc.c:2479
mpc_parser_t * mpc_apply_to(mpc_parser_t *a, mpc_apply_to_t f, void *x)
Definition: mpc.c:1806
mpc_ast_t * mpc_ast_add_child(mpc_ast_t *r, mpc_ast_t *a)
Definition: mpc.c:2974
mpc_val_t * mpcf_state_ast(int n, mpc_val_t **xs)
Definition: mpc.c:3256
void mpc_err_print_to(mpc_err_t *e, FILE *f)
Definition: mpc.c:588
void mpc_ast_traverse_free(mpc_ast_trav_t **trav)
Definition: mpc.c:3201
mpc_val_t * mpcf_escape(mpc_val_t *x)
Definition: mpc.c:2576
mpc_parser_t * mpc_expectf(mpc_parser_t *a, const char *fmt,...)
Definition: mpc.c:1719
mpc_val_t * mpcf_int(mpc_val_t *x)
Definition: mpc.c:2434
mpc_val_t * mpcf_escape_regex(mpc_val_t *x)
Definition: mpc.c:2588
mpc_parser_t * mpca_tag(mpc_parser_t *a, const char *t)
Definition: mpc.c:3269
mpc_parser_t * mpc_hexdigit(void)
Definition: mpc.c:2017
mpc_val_t * mpcf_fst(int n, mpc_val_t **xs)
Definition: mpc.c:2625
mpc_parser_t * mpc_startwith(mpc_parser_t *a)
Definition: mpc.c:2081
mpc_val_t * mpcf_strtriml(mpc_val_t *x)
Definition: mpc.c:2462
void mpc_ast_print_to(mpc_ast_t *a, FILE *fp)
Definition: mpc.c:3040
mpc_val_t * mpcf_strfold(int n, mpc_val_t **xs)
Definition: mpc.c:2648
mpc_parser_t * mpc_many1(mpc_fold_t f, mpc_parser_t *a)
Definition: mpc.c:1910
struct mpc_ast_t mpc_ast_t
void(* mpc_dtor_t)(mpc_val_t *)
Definition: mpc.h:78
mpc_parser_t * mpc_stripr(mpc_parser_t *a)
Definition: mpc.c:2086
mpc_parser_t * mpc_underscore(void)
Definition: mpc.c:2026
mpc_parser_t * mpca_or(int n,...)
Definition: mpc.c:3287
int(* mpc_check_t)(mpc_val_t **)
Definition: mpc.h:85
mpc_val_t * mpcf_null(int n, mpc_val_t **xs)
Definition: mpc.c:2624
mpc_parser_t * mpc_char_lit(void)
Definition: mpc.c:2056
mpc_parser_t * mpc_expect(mpc_parser_t *a, const char *e)
Definition: mpc.c:1690
mpc_parser_t * mpc_and(int n, mpc_fold_t f,...)
Definition: mpc.c:1948
mpc_ast_t * mpc_ast_build(int n, const char *tag,...)
Definition: mpc.c:2928
mpc_parser_t * mpc_tok_squares(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2113
void mpc_print(mpc_parser_t *p)
Definition: mpc.c:2811
mpc_parser_t * mpc_squares(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2102
mpc_val_t * mpcf_unescape_regex(mpc_val_t *x)
Definition: mpc.c:2594
mpc_parser_t * mpc_stripl(mpc_parser_t *a)
Definition: mpc.c:2085
mpc_parser_t * mpc_alphanum(void)
Definition: mpc.c:2027
mpc_ast_t * mpc_ast_add_root(mpc_ast_t *a)
Definition: mpc.c:2946
mpc_err_t * mpca_lang_file(int flags, FILE *f,...)
Definition: mpc.c:3746
void mpc_val_t
Definition: mpc.h:58
mpc_val_t * mpcf_unescape_string_raw(mpc_val_t *x)
Definition: mpc.c:2606
mpc_val_t * mpcf_str_ast(mpc_val_t *c)
Definition: mpc.c:3250
mpc_parser_t * mpc_float(void)
Definition: mpc.c:2052
int mpc_ast_eq(mpc_ast_t *a, mpc_ast_t *b)
Definition: mpc.c:2959
mpc_parser_t * mpc_whitespaces(void)
Definition: mpc.c:2009
mpc_parser_t * mpc_endwith(mpc_parser_t *a, mpc_dtor_t da)
Definition: mpc.c:2082
mpc_parser_t * mpca_state(mpc_parser_t *a)
Definition: mpc.c:3265
void mpc_cleanup(int n,...)
Definition: mpc.c:1596
mpc_ast_t * mpc_ast_state(mpc_ast_t *a, mpc_state_t s)
Definition: mpc.c:3004
mpc_val_t *(* mpc_apply_to_t)(mpc_val_t *, void *)
Definition: mpc.h:82
mpc_parser_t * mpc_boundary(void)
Definition: mpc.c:2005
mpc_parser_t * mpc_tok_brackets(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2112
mpc_parser_t * mpc_hexdigits(void)
Definition: mpc.c:2020
int mpc_test_fail(mpc_parser_t *p, const char *s, const void *d, int(*tester)(const void *, const void *), mpc_dtor_t destructor, void(*printer)(const void *))
Definition: mpc.c:2831
mpc_parser_t * mpc_tok_braces(mpc_parser_t *a, mpc_dtor_t ad)
Definition: mpc.c:2111
mpc_parser_t * mpc_whole(mpc_parser_t *a, mpc_dtor_t da)
Definition: mpc.c:2083
mpc_parser_t * mpc_soi(void)
Definition: mpc.c:1977
mpc_parser_t * mpc_maybe(mpc_parser_t *a)
Definition: mpc.c:1898
mpc_parser_t * mpc_range(char s, char e)
Definition: mpc.c:1754
@ MPCA_LANG_PREDICTIVE
Definition: mpc.h:356
@ MPCA_LANG_WHITESPACE_SENSITIVE
Definition: mpc.h:357
@ MPCA_LANG_DEFAULT
Definition: mpc.h:355
mpc_ast_t * mpc_ast_add_root_tag(mpc_ast_t *a, const char *t)
Definition: mpc.c:2990
int mpc_parse_file(const char *filename, FILE *file, mpc_parser_t *p, mpc_result_t *r)
Definition: mpc.c:1337
@ MPC_RE_M
Definition: mpc.h:271
@ MPC_RE_S
Definition: mpc.h:272
@ MPC_RE_MULTILINE
Definition: mpc.h:273
@ MPC_RE_DEFAULT
Definition: mpc.h:270
@ MPC_RE_DOTALL
Definition: mpc.h:274
mpc_ast_t * mpc_ast_add_tag(mpc_ast_t *a, const char *t)
Definition: mpc.c:2981
mpc_ast_t * mpc_ast_traverse_next(mpc_ast_trav_t **trav)
Definition: mpc.c:3118
mpc_val_t * mpcf_snd_free(int n, mpc_val_t **xs)
Definition: mpc.c:2638
mpc_parser_t * mpc_lower(void)
Definition: mpc.c:2023
mpc_parser_t * mpc_regex_lit(void)
Definition: mpc.c:2065
mpc_val_t *(* mpc_ctor_t)(void)
Definition: mpc.h:79
mpc_parser_t * mpc_pass(void)
Definition: mpc.c:1610
struct mpc_ast_trav_t mpc_ast_trav_t
mpc_parser_t * mpca_grammar(int flags, const char *grammar,...)
Definition: mpc.c:3588
mpc_val_t * mpcf_unescape_char_raw(mpc_val_t *x)
Definition: mpc.c:2618
mpc_parser_t * mpca_many1(mpc_parser_t *a)
Definition: mpc.c:3284
mpc_val_t * mpcf_fst_free(int n, mpc_val_t **xs)
Definition: mpc.c:2637
mpc_val_t * mpcf_trd_free(int n, mpc_val_t **xs)
Definition: mpc.c:2639
mpc_parser_t * mpc_checkf(mpc_parser_t *a, mpc_dtor_t da, mpc_check_t f, const char *fmt,...)
Definition: mpc.c:1838
mpc_parser_t * mpc_state(void)
Definition: mpc.c:1684
mpc_parser_t * mpca_total(mpc_parser_t *a)
Definition: mpc.c:3333
mpc_parser_t * mpc_octdigits(void)
Definition: mpc.c:2021
mpc_parser_t * mpc_count(int n, mpc_fold_t f, mpc_parser_t *a, mpc_dtor_t da)
Definition: mpc.c:1918
mpc_parser_t * mpc_sym(const char *s)
Definition: mpc.c:2089
mpc_parser_t * mpc_anchor(int(*f)(char, char))
Definition: mpc.c:1677
int mpc_test_pass(mpc_parser_t *p, const char *s, const void *d, int(*tester)(const void *, const void *), mpc_dtor_t destructor, void(*printer)(const void *))
Definition: mpc.c:2854
mpc_parser_t * mpc_oct(void)
Definition: mpc.c:2031
mpc_parser_t * mpc_tok(mpc_parser_t *a)
Definition: mpc.c:2088
mpc_parser_t * mpc_or(int n,...)
Definition: mpc.c:1928
int mpc_ast_get_index(mpc_ast_t *ast, const char *tag)
Definition: mpc.c:3044
string FILE
Definition: benchmark.py:21
static RzSocket * s
Definition: rtr.c:28
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
static int
Definition: sfsocketcall.h:114
#define d(i)
Definition: sha256.c:44
#define b(i)
Definition: sha256.c:42
#define f(i)
Definition: sha256.c:46
#define c(i)
Definition: sha256.c:43
#define a(i)
Definition: sha256.c:41
Definition: gzappend.c:170
Definition: mpc.h:284
int children_num
Definition: mpc.h:288
char * tag
Definition: mpc.h:285
struct mpc_ast_t ** children
Definition: mpc.h:289
char * contents
Definition: mpc.h:286
mpc_state_t state
Definition: mpc.h:287
mpc_ast_trav_order_t order
Definition: mpc.h:319
mpc_ast_t * curr_node
Definition: mpc.h:316
struct mpc_ast_trav_t * parent
Definition: mpc.h:317
int curr_child
Definition: mpc.h:318
Definition: mpc.h:40
char ** expected
Definition: mpc.h:45
char received
Definition: mpc.h:46
char * failure
Definition: mpc.h:44
int expected_num
Definition: mpc.h:42
char * filename
Definition: mpc.h:43
mpc_state_t state
Definition: mpc.h:41
long col
Definition: mpc.h:32
int term
Definition: mpc.h:33
long pos
Definition: mpc.h:30
long row
Definition: mpc.h:31
Definition: z80asm.h:102
mpc_err_t * error
Definition: mpc.h:61
mpc_val_t * output
Definition: mpc.h:62