fix cases where compoundlits are constant/get an entity
[cparser] / separator_t.h
1 #ifndef SEPARATOR_H
2 #define SEPARATOR_H
3
4 #include <stdbool.h>
5
6 typedef struct separator_t separator_t;
7 struct separator_t
8 {
9         char const *first; /**< Returned on the first call to sep_next(). */
10         char const *rest;  /**< Returned on all further calls to sep_next(). */
11 };
12
13 /**
14  * Returns first on the first call for s and rest on all further calls.
15  */
16 static inline char const* sep_next(separator_t* const s)
17 {
18         char const *const cur = s->first;
19         s->first = s->rest;
20         return cur;
21 }
22
23 /**
24  * Returns whether sep_next() has not been called for s.
25  */
26 static inline bool sep_at_first(separator_t const* const s)
27 {
28         return s->first != s->rest;
29 }
30
31 #endif