diff --git a/src/hammer.c b/src/hammer.c index 7d1dabb..2365a91 100644 --- a/src/hammer.c +++ b/src/hammer.c @@ -435,3 +435,164 @@ parse_result_t* parse(const parser_t* parser, const uint8_t* input, size_t lengt return res; } + +#ifdef INCLUDE_TESTS + +#define MK_INPUT_STREAM(buf,len,endianness_) \ + { \ + .input = (uint8_t*)buf, \ + .length = len, \ + .index = 0, \ + .bit_offset = (((endianness_) & BIT_BIG_ENDIAN) ? 8 : 0), \ + .endianness = endianness_ \ + } + +static void test_token(void) { + +} + +static void test_ch(void) { + +} + +static void test_range(void) { + +} + +static void test_int64(void) { + +} + +static void test_int32(void) { + +} + +static void test_int16(void) { + +} + +static void test_int8(void) { + +} + +static void test_uint64(void) { + +} + +static void test_uint32(void) { + +} + +static void test_uint16(void) { + +} + +static void test_uint8(void) { + +} + +static void test_float64(void) { + +} + +static void test_float32(void) { + +} + +static void test_whitespace(void) { + +} + +static void test_action(void) { + +} + +static void test_left_factor_action(void) { + +} + +static void test_notin(void) { + +} + +static void test_end_p(void) { + +} + +static void test_nothing_p(void) { + +} + +static void test_sequence(void) { + +} + +static void test_choice(void) { + +} + +static void test_butnot(void) { + +} + +static void test_difference(void) { + +} + +static void test_xor(void) { + +} + +static void test_repeat0(void) { + +} + +static void test_repeat1(void) { + +} + +static void test_repeat_n(void) { + +} + +static void test_optional(void) { + +} + +static void test_expect(void) { + +} + +static void test_chain(void) { + +} + +static void test_chainl(void) { + +} + +static void test_list(void) { + +} + +static void test_epsilon_p(void) { + +} + +static void test_semantic(void) { + +} + +static void test_and(void) { + +} + +static void test_not(void) { + +} + +static void test_ignore(void) { + +} + +#endif // #ifdef INCLUDE_TESTS diff --git a/src/hammer.h b/src/hammer.h index b0a9c1a..07e21e4 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -93,6 +93,36 @@ const parser_t* ch(const uint8_t c); /* Given two single-character bounds, lower and upper, returns a parser that parses a single character within the range [lower, upper] (inclusive). */ const parser_t* range(const uint8_t lower, const uint8_t upper); +/* Returns a parser that parses a signed 8-byte integer value. */ +const parser_t* int64(); + +/* Returns a parser that parses a signed 4-byte integer value. */ +const parser_t* int32(); + +/* Returns a parser that parses a signed 2-byte integer value. */ +const parser_t* int16(); + +/* Returns a parser that parses a signed 1-byte integer value. */ +const parser_t* int8(); + +/* Returns a parser that parses an unsigned 8-byte integer value. */ +const parser_t* uint64(); + +/* Returns a parser that parses an unsigned 4-byte integer value. */ +const parser_t* uint32(); + +/* Returns a parser that parses an unsigned 2-byte integer value. */ +const parser_t* uint16(); + +/* Returns a parser that parses an unsigned 1-byte integer value. */ +const parser_t* uint8(); + +/* Returns a parser that parses a double-precision floating-point value. */ +const parser_t* float64(); + +/* Returns a parser that parses a single-precision floating-point value. */ +const parser_t* float32(); + /* Given another parser, p, returns a parser that skips any whitespace and then applies p. */ const parser_t* whitespace(const parser_t* p);