qse/ase/stx/parser.h

63 lines
1.1 KiB
C
Raw Normal View History

2005-05-12 15:51:20 +00:00
/*
2005-06-06 03:47:56 +00:00
* $Id: parser.h,v 1.11 2005-06-06 03:47:34 bacon Exp $
2005-05-12 15:51:20 +00:00
*/
#ifndef _XP_STX_PARSER_H_
#define _XP_STX_PARSER_H_
2005-05-22 04:11:54 +00:00
#include <xp/stx/stx.h>
2005-06-04 07:01:57 +00:00
#include <xp/stx/token.h>
2005-05-22 04:11:54 +00:00
2005-06-05 05:27:02 +00:00
enum
{
XP_STX_PARSER_ERROR_NONE = 0,
XP_STX_PARSER_ERROR_INPUT,
2005-06-05 16:44:05 +00:00
XP_STX_PARSER_ERROR_MEMORY,
2005-06-05 05:27:02 +00:00
XP_STX_PARSER_ERROR_INVALID,
2005-06-05 16:44:05 +00:00
XP_STX_PARSER_ERROR_CHAR,
XP_STX_PARSER_ERROR_CHARLIT,
XP_STX_PARSER_ERROR_STRLIT
2005-06-05 05:27:02 +00:00
};
2005-06-06 03:47:56 +00:00
/* input_func cmd */
enum
{
XP_STX_PARSER_INPUT_OPEN,
XP_STX_PARSER_INPUT_CLOSE,
XP_STX_PARSER_INPUT_CONSUME,
XP_STX_PARSER_INPUT_REWIND
};
2005-06-05 05:27:02 +00:00
typedef struct xp_stx_parser_t xp_stx_parser_t;
2005-05-22 04:11:54 +00:00
struct xp_stx_parser_t
{
2005-05-30 15:27:31 +00:00
int error_code;
2005-06-04 07:01:57 +00:00
xp_stx_token_t token;
2005-06-05 05:27:02 +00:00
xp_stx_cint_t curc;
xp_stx_cint_t ungotc[5];
xp_size_t ungotc_count;
2005-06-06 03:47:56 +00:00
void* input_owner;
int (*input_func) (int cmd, void* owner, void* arg);
2005-06-04 07:01:57 +00:00
2005-05-22 04:11:54 +00:00
xp_bool_t __malloced;
};
2005-05-12 15:51:20 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2005-05-22 04:11:54 +00:00
xp_stx_parser_t* xp_stx_parser_open (xp_stx_parser_t* parser);
2005-05-22 15:03:20 +00:00
void xp_stx_parser_close (xp_stx_parser_t* parser);
2005-06-05 16:44:05 +00:00
int xp_stx_parser_parse_method (
xp_stx_parser_t* parser, xp_stx_word_t method_class, void* input);
2005-06-02 16:14:58 +00:00
2005-05-12 15:51:20 +00:00
#ifdef __cplusplus
}
#endif
#endif