*** empty log message ***

This commit is contained in:
hyung-hwan 2005-06-04 07:01:57 +00:00
parent 0322d27e80
commit 8d30a1830b
5 changed files with 29 additions and 94 deletions

View File

@ -1,46 +0,0 @@
/*
* $Id
*/
#include <xp/stx/lexer.h>
#include <xp/stx/parser.h>
#include <xp/stx/misc.h>
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;
}

View File

@ -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 <xp/stx/stx.h>
#include <xp/stx/token.h>
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

View File

@ -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

View File

@ -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 <xp/stx/parser.h>
@ -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;
}

View File

@ -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 <xp/stx/stx.h>
#include <xp/stx/lexer.h>
#include <xp/stx/token.h>
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;
};