From 2433bcb17b5f27e37e537bf41cf16531e3a64c77 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 12 Jun 2005 16:07:23 +0000 Subject: [PATCH] *** empty log message *** --- ase/stx/parser.c | 20 +++++++++++++++++++- ase/stx/token.c | 11 ++++++++++- ase/stx/token.h | 3 ++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ase/stx/parser.c b/ase/stx/parser.c index 8c701c24..17002054 100644 --- a/ase/stx/parser.c +++ b/ase/stx/parser.c @@ -1,5 +1,5 @@ /* - * $Id: parser.c,v 1.28 2005-06-12 15:46:02 bacon Exp $ + * $Id: parser.c,v 1.29 2005-06-12 16:07:23 bacon Exp $ */ #include @@ -158,6 +158,7 @@ static int __parse_message_pattern (xp_stx_parser_t* parser) */ int n; + xp_stx_name_clear (&parser->method_name); while (parser->argument_count > 0) { xp_free (parser->argument[--parser->argument_count]); } @@ -182,6 +183,12 @@ static int __parse_message_pattern (xp_stx_parser_t* parser) static int __parse_unary_pattern (xp_stx_parser_t* parser) { /* TODO: check if the method name exists */ + if (xp_stx_name_adds( + &parser->method_name, parser->token.buffer) == -1) { + parser->error_code = XP_STX_PARSER_ERROR_MEMORY; + return -1; + } + GET_TOKEN (parser); return 0; } @@ -189,6 +196,11 @@ static int __parse_unary_pattern (xp_stx_parser_t* parser) static int __parse_binary_pattern (xp_stx_parser_t* parser) { /* TODO: check if the method name exists */ + if (xp_stx_name_adds( + &parser->method_name, parser->token.buffer) == -1) { + parser->error_code = XP_STX_PARSER_ERROR_MEMORY; + return -1; + } GET_TOKEN (parser); if (parser->token.type != XP_STX_TOKEN_IDENT) { @@ -217,6 +229,12 @@ static int __parse_binary_pattern (xp_stx_parser_t* parser) static int __parse_keyword_pattern (xp_stx_parser_t* parser) { do { + if (xp_stx_name_adds( + &parser->method_name, parser->token.buffer) == -1) { + parser->error_code = XP_STX_PARSER_ERROR_MEMORY; + return -1; + } + GET_TOKEN (parser); if (parser->token.type != XP_STX_TOKEN_IDENT) { parser->error_code = XP_STX_PARSER_ERROR_ARGUMENT_NAME; diff --git a/ase/stx/token.c b/ase/stx/token.c index 9bb743ce..95f320a8 100644 --- a/ase/stx/token.c +++ b/ase/stx/token.c @@ -1,5 +1,5 @@ /* - * $Id: token.c,v 1.7 2005-06-12 15:46:02 bacon Exp $ + * $Id: token.c,v 1.8 2005-06-12 16:07:23 bacon Exp $ */ #include @@ -87,6 +87,15 @@ int xp_stx_token_addc (xp_stx_token_t* token, xp_cint_t c) return 0; } +int xp_stx_token_adds (xp_stx_token_t* token, const xp_char_t* s) +{ + while (*s != XP_CHAR('\0')) { + if (xp_stx_token_addc(token, *s) == -1) return -1; + } + + return 0; +} + void xp_stx_token_clear (xp_stx_token_t* token) { /* diff --git a/ase/stx/token.h b/ase/stx/token.h index 8b5e45fe..62c53913 100644 --- a/ase/stx/token.h +++ b/ase/stx/token.h @@ -1,5 +1,5 @@ /* - * $Id: token.h,v 1.13 2005-06-12 15:46:02 bacon Exp $ + * $Id: token.h,v 1.14 2005-06-12 16:07:23 bacon Exp $ */ #ifndef _XP_STX_TOKEN_H_ @@ -55,6 +55,7 @@ xp_stx_token_t* xp_stx_token_open ( void xp_stx_token_close (xp_stx_token_t* token); int xp_stx_token_addc (xp_stx_token_t* token, xp_cint_t c); +int xp_stx_token_adds (xp_stx_token_t* token, const xp_char_t* s); void xp_stx_token_clear (xp_stx_token_t* token); xp_char_t* xp_stx_token_yield (xp_stx_token_t* token, xp_word_t capacity); int xp_stx_token_compare (xp_stx_token_t* token, const xp_char_t* str);