From 8d30a1830b9f352919ef92be5a11cb549253db94 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 4 Jun 2005 07:01:57 +0000 Subject: [PATCH] *** empty log message *** --- ase/stx/lexer.c | 46 -------------------------------------------- ase/stx/lexer.h | 36 ---------------------------------- ase/stx/makefile.lcc | 4 ++-- ase/stx/parser.c | 25 +++++++++++++++++------- ase/stx/parser.h | 12 +++++++++--- 5 files changed, 29 insertions(+), 94 deletions(-) delete mode 100644 ase/stx/lexer.c delete mode 100644 ase/stx/lexer.h diff --git a/ase/stx/lexer.c b/ase/stx/lexer.c deleted file mode 100644 index d8c9e100..00000000 --- a/ase/stx/lexer.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * $Id - */ - -#include -#include -#include - -xp_stx_lexer_t* xp_stx_lexer_open ( - xp_stx_lexer_t* lexer, const xp_stx_char_t* text) -{ - if (lexer == XP_NULL) { - lexer = (xp_stx_lexer_t*) - xp_stx_malloc (xp_sizeof(xp_stx_lexer_t)); - if (lexer == XP_NULL) return XP_NULL; - lexer->__malloced = xp_true; - } - else lexer->__malloced = xp_false; - - if (xp_stx_token_open (&lexer->token, 256) == XP_NULL) { - if (lexer->__malloced) xp_stx_free (lexer); - return XP_NULL; - } - - lexer->text = text; - return lexer; -}; - -void xp_stx_lexer_close (xp_stx_lexer_t* lexer) -{ - xp_stx_token_close (&lexer->token); - if (lexer->__malloced) xp_stx_free (lexer); -} - -void xp_stx_lexer_reset ( - xp_stx_lexer_t* lexer, const xp_stx_char_t* text) -{ - xp_stx_token_clear (&lexer->token); - lexer->text = text; -} - -xp_stx_token_t* xp_stx_lexer_consume (xp_stx_lexer_t* lexer) -{ - /* TODO */ - return &lexer->token; -} diff --git a/ase/stx/lexer.h b/ase/stx/lexer.h deleted file mode 100644 index 5715ae97..00000000 --- a/ase/stx/lexer.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id: lexer.h,v 1.2 2005-06-02 16:14:58 bacon Exp $ - */ - -#ifndef _XP_STX_LEXER_H_ -#define _XP_STX_LEXER_H_ - -#include -#include - -struct xp_stx_lexer_t -{ - xp_stx_token_t token; - const xp_stx_char_t* text; - xp_bool_t __malloced; -}; - -typedef struct xp_stx_lexer_t xp_stx_lexer_t; - -#ifdef __cplusplus -extern "C" { -#endif - -xp_stx_lexer_t* xp_stx_lexer_open ( - xp_stx_lexer_t* lexer, const xp_stx_char_t* text); -void xp_stx_lexer_close (xp_stx_lexer_t* lexer); - -void xp_stx_lexer_reset ( - xp_stx_lexer_t* lexer, const xp_stx_char_t* text); -xp_stx_token_t* xp_stx_lexer_consume (xp_stx_lexer_t* lexer); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ase/stx/makefile.lcc b/ase/stx/makefile.lcc index 1ef1b2c5..09560e88 100644 --- a/ase/stx/makefile.lcc +++ b/ase/stx/makefile.lcc @@ -1,7 +1,7 @@ SRCS = stx.c memory.c object.c symbol.c class.c \ - hash.c misc.c context.c token.c lexer.c parser.c bootstrp.c + hash.c misc.c context.c token.c parser.c bootstrp.c OBJS = stx.obj memory.obj object.obj symbol.obj class.obj \ - hash.obj misc.obj context.obj token.obj lexer.obj parser.obj bootstrp.obj + hash.obj misc.obj context.obj token.obj parser.obj bootstrp.obj OUT = xpstx.lib CC = lcc diff --git a/ase/stx/parser.c b/ase/stx/parser.c index 5c1fbcec..2ab90915 100644 --- a/ase/stx/parser.c +++ b/ase/stx/parser.c @@ -1,5 +1,5 @@ /* - * $Id: parser.c,v 1.9 2005-06-02 16:14:58 bacon Exp $ + * $Id: parser.c,v 1.10 2005-06-04 07:01:57 bacon Exp $ */ #include @@ -16,32 +16,43 @@ xp_stx_parser_t* xp_stx_parser_open (xp_stx_parser_t* parser) } else parser->__malloced = xp_false; - if (xp_stx_lexer_open (&parser->lexer, XP_NULL) == XP_NULL) { + if (xp_stx_token_open (&parser->token, 256) == XP_NULL) { if (parser->__malloced) xp_stx_free (parser); return XP_NULL; } - //parser->token = XP_NULL; parser->error_code = 0; + parser->text = XP_NULL; + parser->curc = XP_CHAR_EOF; + parser->curp = XP_NULL; return parser; } void xp_stx_parser_close (xp_stx_parser_t* parser) { - xp_stx_lexer_close (&parser->lexer); + xp_stx_token_close (&parser->token); if (parser->__malloced) xp_stx_free (parser); } int xp_stx_parser_parse_method (xp_stx_parser_t* parser, xp_stx_word_t method_class, xp_stx_char_t* method_text) { - xp_stx_lexer_reset (&parser->lexer, method_text); + /*xp_stx_lexer_reset (&parser->lexer, text);*/ +#if 0 + parser->token = xp_stx_lexer_consume (&parser->lexer); + if (parser->token == XP_NULL) { //parser->token = xp_stx_lexer_consume (&parser->lexer); //if (parser->token == XP_NULL) { /*parser->error_code = xxx;*/ - // return -1; - //} + return -1; + } +#endif return 0; } + +static int __get_token (xp_stx_parser_t* parser) +{ + return -1; +} diff --git a/ase/stx/parser.h b/ase/stx/parser.h index 34000c07..6b5f896a 100644 --- a/ase/stx/parser.h +++ b/ase/stx/parser.h @@ -1,17 +1,23 @@ /* - * $Id: parser.h,v 1.7 2005-06-02 16:14:58 bacon Exp $ + * $Id: parser.h,v 1.8 2005-06-04 07:01:57 bacon Exp $ */ #ifndef _XP_STX_PARSER_H_ #define _XP_STX_PARSER_H_ #include -#include +#include struct xp_stx_parser_t { - xp_stx_lexer_t lexer; int error_code; + xp_stx_token_t token; + + /* lexer data */ + const xp_char_t* text; + const xp_cint_t curc; + const xp_char_t* curp; + xp_bool_t __malloced; };