Merge remote-tracking branch 'bunter/master'
Also, fix makefile Conflicts: src/hammer.c
This commit is contained in:
commit
40be28fb7e
5 changed files with 196 additions and 48 deletions
18
src/hammer.h
18
src/hammer.h
|
|
@ -41,11 +41,13 @@ typedef enum token_type {
|
|||
TT_MAX
|
||||
} token_type_t;
|
||||
|
||||
typedef struct parsed_token parsed_token_t;
|
||||
|
||||
typedef struct counted_array {
|
||||
size_t capacity;
|
||||
size_t used;
|
||||
arena_t arena;
|
||||
void **elements;
|
||||
parsed_token_t **elements;
|
||||
} counted_array_t;
|
||||
|
||||
typedef struct parsed_token {
|
||||
|
|
@ -130,7 +132,14 @@ const parser_t* ch(const uint8_t c);
|
|||
*
|
||||
* Result token type: TT_UINT
|
||||
*/
|
||||
const parser_t* range(const uint8_t lower, const uint8_t upper);
|
||||
const parser_t* ch_range(const uint8_t lower, const uint8_t upper);
|
||||
|
||||
/**
|
||||
* Given an integer parser, p, and two integer bounds, lower and upper,
|
||||
* returns a parser that parses an integral value within the range
|
||||
* [lower, upper] (inclusive).
|
||||
*/
|
||||
const parser_t* int_range(const parser_t *p, const int64_t lower, const int64_t upper);
|
||||
|
||||
/**
|
||||
* Returns a parser that parses the specified number of bits. sign ==
|
||||
|
|
@ -360,8 +369,13 @@ const parser_t* length_value(const parser_t* length, const parser_t* value);
|
|||
* This parser attaches a predicate function, which returns true or
|
||||
* false, to a parser. The function is evaluated over the parser's
|
||||
* result.
|
||||
*
|
||||
* The parse only succeeds if the attribute function returns true.
|
||||
*
|
||||
* attr_bool will check whether p's result exists and whether p's
|
||||
* result AST exists; you do not need to check for this in your
|
||||
* predicate function.
|
||||
*
|
||||
* Result token type: p's result type if pred succeeded, NULL otherwise.
|
||||
*/
|
||||
const parser_t* attr_bool(const parser_t* p, predicate_t pred);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue