2005-05-22 10:32:37 +00:00
|
|
|
/*
|
2005-06-06 16:04:18 +00:00
|
|
|
* $Id: token.h,v 1.5 2005-06-06 16:01:49 bacon Exp $
|
2005-05-22 10:32:37 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _XP_STX_TOKEN_H_
|
|
|
|
#define _XP_STX_TOKEN_H_
|
|
|
|
|
|
|
|
#include <xp/stx/stx.h>
|
|
|
|
|
2005-06-02 16:14:58 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-06-05 16:44:05 +00:00
|
|
|
XP_STX_TOKEN_END = 0,
|
|
|
|
XP_STX_TOKEN_CHARLIT,
|
|
|
|
XP_STX_TOKEN_STRLIT,
|
|
|
|
XP_STX_TOKEN_IDENT,
|
2005-06-06 16:04:18 +00:00
|
|
|
XP_STX_TOKEN_KEYWORD,
|
|
|
|
XP_STX_TOKEN_RETURN
|
2005-06-02 16:14:58 +00:00
|
|
|
};
|
|
|
|
|
2005-05-22 10:32:37 +00:00
|
|
|
struct xp_stx_token_t
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
|
|
|
|
/*
|
|
|
|
xp_stx_int_t ivalue;
|
|
|
|
xp_stx_real_t fvalue;
|
|
|
|
*/
|
|
|
|
|
2005-05-22 13:41:14 +00:00
|
|
|
xp_stx_word_t capacity;
|
|
|
|
xp_stx_word_t size;
|
|
|
|
xp_stx_char_t* buffer;
|
2005-05-22 10:32:37 +00:00
|
|
|
|
|
|
|
xp_bool_t __malloced;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct xp_stx_token_t xp_stx_token_t;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
xp_stx_token_t* xp_stx_token_open (
|
|
|
|
xp_stx_token_t* token, xp_stx_word_t capacity);
|
|
|
|
void xp_stx_token_close (xp_stx_token_t* token);
|
|
|
|
|
2005-05-22 13:41:14 +00:00
|
|
|
int xp_stx_token_addc (xp_stx_token_t* token, xp_stx_cint_t c);
|
|
|
|
void xp_stx_token_clear (xp_stx_token_t* token);
|
|
|
|
xp_stx_char_t* xp_stx_token_yield (xp_stx_token_t* token, xp_stx_word_t capacity);
|
|
|
|
int xp_stx_token_compare (xp_stx_token_t* token, const xp_stx_char_t* str);
|
2005-05-22 10:32:37 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|