libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
tstream_short.h
Go to the documentation of this file.
1// Copyright (C) 2023 Ethan Uppal. All rights reserved.
2
3#pragma once
4
5#include "def.h"
6#include "tstream.h"
7
17void ps_tstream_eof_error(struct ps_tstream* ts, int code, STR ctx, STR fix);
18
19#define eof() ps_tstream_is_eof(ts)
20
21#define adv() ps_tstream_advance(ts)
22
27#define match(type, ctx) \
28 if (ps_tstream_match(ts, type, ctx)) { \
29 }
30
35#define bindmatch(val, type, ctx) \
36 auto_t val = ps_tstream_match(ts, type, ctx); \
37 if (val) { \
38 }
39
43#define bindmatch_any(val, types, ctx) \
44 auto_t val = ps_tstream_match_any(ts, types, lengthof(types), ctx); \
45 if (val) { \
46 }
47
48#define tcur() ps_tstream_current(ts)
49
50#define unwind() ps_tstream_advance_n(ts, -1)
Base definitions.
#define STR
Definition def.h:40
Processes tokens in a stream.
Definition tstream.h:16
Token stream processing.
void ps_tstream_eof_error(struct ps_tstream *ts, int code, STR ctx, STR fix)
Reports an end-of-file error with the given context ctx, using the last token in ts for location.
Definition tstream.c:99