qse/ase/stx/parser.h

79 lines
1.4 KiB
C
Raw Normal View History

2005-05-12 15:51:20 +00:00
/*
2005-06-12 15:46:02 +00:00
* $Id: parser.h,v 1.18 2005-06-12 15:46:02 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
{
2005-06-08 03:16:34 +00:00
XP_STX_PARSER_ERROR_NONE,
/* system errors */
2005-06-12 12:33:31 +00:00
XP_STX_PARSER_ERROR_INPUT_FUNC,
2005-06-08 03:16:34 +00:00
XP_STX_PARSER_ERROR_INPUT,
2005-06-12 12:33:31 +00:00
XP_STX_PARSER_ERROR_MEMORY,
2005-06-08 03:16:34 +00:00
/* lexical errors */
2005-06-05 16:44:05 +00:00
XP_STX_PARSER_ERROR_CHAR,
XP_STX_PARSER_ERROR_CHARLIT,
2005-06-08 03:16:34 +00:00
XP_STX_PARSER_ERROR_STRLIT,
/* syntatic error */
2005-06-11 18:01:25 +00:00
XP_STX_PARSER_ERROR_MESSAGE_SELECTOR,
2005-06-12 12:33:31 +00:00
XP_STX_PARSER_ERROR_TEMPORARIES_NOT_CLOSED,
2005-06-12 14:40:35 +00:00
XP_STX_PARSER_ERROR_ARGUMENT_NAME,
XP_STX_PARSER_ERROR_TOO_MANY_ARGUMENTS,
2005-06-12 12:33:31 +00:00
XP_STX_PARSER_ERROR_EXPRESSION_START,
XP_STX_PARSER_ERROR_NO_PERIOD
2005-06-05 05:27:02 +00:00
};
2005-06-06 03:47:56 +00:00
enum
{
2005-06-08 03:16:34 +00:00
/* input_func cmd */
2005-06-06 03:47:56 +00:00
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-06-08 03:19:31 +00:00
xp_stx_t* stx;
2005-05-30 15:27:31 +00:00
int error_code;
2005-06-04 07:01:57 +00:00
2005-06-12 15:46:02 +00:00
xp_char_t* argument[32];
2005-06-12 14:40:35 +00:00
xp_size_t argument_count;
xp_stx_token_t token;
2005-06-08 16:05:41 +00:00
xp_cint_t curc;
xp_cint_t ungotc[5];
2005-06-05 05:27:02 +00:00
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-06-08 03:19:31 +00:00
xp_stx_parser_t* xp_stx_parser_open (xp_stx_parser_t* parser, xp_stx_t* stx);
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 (
2005-06-08 16:05:41 +00:00
xp_stx_parser_t* parser, xp_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