47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
// Copyright © 2017 Project Golan, all rights reserved.
|
|
#ifndef m_tokbuf_h
|
|
#define m_tokbuf_h
|
|
|
|
#include "m_token.h"
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
struct M_tkbuf;
|
|
void M_TokBuf_Ctor(struct M_tkbuf *tb);
|
|
void M_TokBuf_Dtor(struct M_tkbuf *tb);
|
|
M_token *M_TokBuf_Get(struct M_tkbuf *tb);
|
|
M_token *M_TokBuf_UnGet(struct M_tkbuf *tb);
|
|
M_token *M_TokBuf_ReGet(struct M_tkbuf *tb);
|
|
bool M_TokBuf_Drop(struct M_tkbuf *tb, M_tokty t);
|
|
|
|
// Types ---------------------------------------------------------------------|
|
|
|
|
enum M_tkprc
|
|
{
|
|
tokproc_next,
|
|
tokproc_done,
|
|
tokproc_skip
|
|
};
|
|
|
|
typedef struct M_tkbuf
|
|
{
|
|
#if __GDCC__
|
|
__prop ctor {call: M_TokBuf_Ctor (this)}
|
|
__prop dtor {call: M_TokBuf_Dtor (this)}
|
|
__prop get {call: M_TokBuf_Get (this)}
|
|
__prop unget {call: M_TokBuf_UnGet(this)}
|
|
__prop reget {call: M_TokBuf_ReGet(this)}
|
|
__prop drop {call: M_TokBuf_Drop (this)}
|
|
#endif
|
|
|
|
FILE *fp;
|
|
M_token *toks;
|
|
int tpos, tend;
|
|
int bbeg, bend;
|
|
void *udata;
|
|
|
|
enum M_tkprc (*tokProcess)(M_token *tok, void *udata);
|
|
} M_tkbuf;
|
|
|
|
#endif
|