qse/ase/stx/parser.h

55 lines
1004 B
C
Raw Normal View History

2005-05-12 15:51:20 +00:00
/*
2005-06-05 16:44:05 +00:00
* $Id: parser.h,v 1.10 2005-06-05 16:44:05 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
};
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;
void* input;
int (*input_reset) (xp_stx_parser_t*);
int (*input_consume) (xp_stx_parser_t*, xp_stx_cint_t*);
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