add glue helper to construct sized sequences
This commit is contained in:
parent
866e66ccf9
commit
0cfec9781a
2 changed files with 9 additions and 0 deletions
|
|
@ -173,6 +173,7 @@ const HParsedToken *h_act_flatten(const HParseResult *p);
|
|||
|
||||
HParsedToken *h_make(HArena *arena, HTokenType type, void *value);
|
||||
HParsedToken *h_make_seq(HArena *arena); // Makes empty sequence.
|
||||
HParsedToken *h_make_seqn(HArena *arena, size_t n); // Makes empty sequence of expected size n.
|
||||
HParsedToken *h_make_bytes(HArena *arena, size_t len);
|
||||
HParsedToken *h_make_sint(HArena *arena, int64_t val);
|
||||
HParsedToken *h_make_uint(HArena *arena, uint64_t val);
|
||||
|
|
@ -180,6 +181,7 @@ HParsedToken *h_make_uint(HArena *arena, uint64_t val);
|
|||
// Standard short-hands to make tokens in an action.
|
||||
#define H_MAKE(TYP, VAL) h_make(p->arena, TT_ ## TYP, VAL)
|
||||
#define H_MAKE_SEQ() h_make_seq(p->arena)
|
||||
#define H_MAKE_SEQN(N) h_make_seqn(p->arena, N)
|
||||
#define H_MAKE_BYTES(LEN) h_make_bytes(p->arena, LEN)
|
||||
#define H_MAKE_SINT(VAL) h_make_sint(p->arena, VAL)
|
||||
#define H_MAKE_UINT(VAL) h_make_uint(p->arena, VAL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue