lang: ast: add support for multiple block termination tokens
This commit is contained in:
@@ -3,10 +3,24 @@
|
||||
|
||||
#include "ctx.h"
|
||||
|
||||
#define BLOCK_TERMINATOR_MAX 8
|
||||
|
||||
struct block_parser_state {
|
||||
struct parser_state s_base;
|
||||
bool s_single_expr;
|
||||
unsigned int s_terminator;
|
||||
|
||||
/* the block will be terminated when any token in this list
|
||||
* is encountered. the token that terminated the block will
|
||||
* not be consumed. */
|
||||
unsigned short s_terminators[BLOCK_TERMINATOR_MAX];
|
||||
unsigned short s_nr_terminators;
|
||||
};
|
||||
|
||||
#endif
|
||||
extern void block_add_terminator(
|
||||
struct block_parser_state *state, unsigned short tok);
|
||||
extern void block_copy_terminators(
|
||||
const struct block_parser_state *src, struct block_parser_state *dest);
|
||||
extern bool block_terminates_at_token(
|
||||
struct block_parser_state *state, unsigned short tok);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user