2005-05-22 10:32:37 +00:00
|
|
|
/*
|
2005-12-05 15:11:29 +00:00
|
|
|
* $Id: token.h,v 1.18 2005-12-05 15:11:29 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-12 16:22:47 +00:00
|
|
|
#include <xp/stx/name.h>
|
2005-05-22 10:32:37 +00:00
|
|
|
|
2005-06-02 16:14:58 +00:00
|
|
|
enum
|
|
|
|
{
|
2005-06-11 18:01:25 +00:00
|
|
|
XP_STX_TOKEN_END,
|
2005-06-05 16:44:05 +00:00
|
|
|
XP_STX_TOKEN_CHARLIT,
|
|
|
|
XP_STX_TOKEN_STRLIT,
|
2005-06-23 04:59:00 +00:00
|
|
|
XP_STX_TOKEN_SYMLIT,
|
2005-06-07 16:09:58 +00:00
|
|
|
XP_STX_TOKEN_NUMLIT,
|
2005-06-05 16:44:05 +00:00
|
|
|
XP_STX_TOKEN_IDENT,
|
2005-06-08 03:19:31 +00:00
|
|
|
XP_STX_TOKEN_BINARY,
|
2005-06-06 16:04:18 +00:00
|
|
|
XP_STX_TOKEN_KEYWORD,
|
2005-06-08 15:49:35 +00:00
|
|
|
XP_STX_TOKEN_PRIMITIVE,
|
2005-06-07 16:09:58 +00:00
|
|
|
XP_STX_TOKEN_ASSIGN,
|
|
|
|
XP_STX_TOKEN_COLON,
|
|
|
|
XP_STX_TOKEN_RETURN,
|
|
|
|
XP_STX_TOKEN_LBRACKET,
|
|
|
|
XP_STX_TOKEN_RBRACKET,
|
2005-06-12 12:33:31 +00:00
|
|
|
XP_STX_TOKEN_LPAREN,
|
|
|
|
XP_STX_TOKEN_RPAREN,
|
2005-06-23 04:59:00 +00:00
|
|
|
XP_STX_TOKEN_APAREN,
|
2005-06-19 16:16:33 +00:00
|
|
|
XP_STX_TOKEN_PERIOD,
|
|
|
|
XP_STX_TOKEN_SEMICOLON
|
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-06-12 16:22:47 +00:00
|
|
|
xp_stx_name_t name;
|
2005-12-05 15:11:29 +00:00
|
|
|
xp_bool_t __dynamic;
|
2005-05-22 10:32:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct xp_stx_token_t xp_stx_token_t;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
xp_stx_token_t* xp_stx_token_open (
|
2005-06-08 16:05:41 +00:00
|
|
|
xp_stx_token_t* token, xp_word_t capacity);
|
2005-05-22 10:32:37 +00:00
|
|
|
void xp_stx_token_close (xp_stx_token_t* token);
|
|
|
|
|
2005-06-08 16:05:41 +00:00
|
|
|
int xp_stx_token_addc (xp_stx_token_t* token, xp_cint_t c);
|
2005-06-12 16:07:23 +00:00
|
|
|
int xp_stx_token_adds (xp_stx_token_t* token, const xp_char_t* s);
|
2005-05-22 13:41:14 +00:00
|
|
|
void xp_stx_token_clear (xp_stx_token_t* token);
|
2005-06-08 16:05:41 +00:00
|
|
|
xp_char_t* xp_stx_token_yield (xp_stx_token_t* token, xp_word_t capacity);
|
2005-06-12 16:22:47 +00:00
|
|
|
int xp_stx_token_compare_name (xp_stx_token_t* token, const xp_char_t* str);
|
2005-05-22 10:32:37 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|