version 1.5, 2000/10/10 05:23:21 |
version 1.10, 2003/02/03 23:13:23 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- mode: C; coding: euc-japan -*- */ |
/* $OpenXM: OpenXM/src/ox_toolkit/parse.c,v 1.4 2000/03/10 12:24:39 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/parse.c,v 1.9 2003/01/13 12:03:12 ohara Exp $ */ |
|
|
/* |
/* |
This module is a parser for OX/CMO expressions. |
This module is a parser for OX/CMO expressions. |
Some commnets is written in Japanese by using the EUC-JP coded |
Some commnets are written in Japanese by using the EUC-JP coded |
character set. |
character set. |
*/ |
*/ |
|
|
Line 96 static jmp_buf env_parse; |
|
Line 96 static jmp_buf env_parse; |
|
/* This is a parsing fault. */ |
/* This is a parsing fault. */ |
static void parse_error(char *s) |
static void parse_error(char *s) |
{ |
{ |
fprintf(stderr, "syntax error: %s\n", s); |
ox_printf("syntax error: %s\n", s); |
longjmp(env_parse, 1); |
longjmp(env_parse, 1); |
} |
} |
|
|
Line 577 static int mygetc() |
|
Line 577 static int mygetc() |
|
|
|
static void init_lex(char *s) |
static void init_lex(char *s) |
{ |
{ |
|
c=' '; |
mygetc_ptr=s; |
mygetc_ptr=s; |
} |
} |
|
|
Line 684 symbol_t lookup(int i) |
|
Line 685 symbol_t lookup(int i) |
|
return &symbol_list[i]; |
return &symbol_list[i]; |
} |
} |
|
|
char *symbol_get_key(symbol_t sp) |
char *get_symbol_by_tag(int tag) |
{ |
{ |
return sp->key; |
symbol_t symp = lookup_by_tag(tag); |
|
return (symp != NULL)? symp->key: NULL; |
} |
} |
|
|
/* no measure for buffer overflow */ |
/* no measure for buffer overflow */ |
Line 710 static char *lex_quoted_string() |
|
Line 712 static char *lex_quoted_string() |
|
} |
} |
buffer[i]=c; |
buffer[i]=c; |
} |
} |
fprintf(stderr, "buffer overflow!\n"); |
ox_printf("buffer overflow!\n"); |
exit(1); |
exit(1); |
/* return NULL; */ |
/* return NULL; */ |
} |
} |
Line 723 static int token_of_symbol(char *key) |
|
Line 725 static int token_of_symbol(char *key) |
|
return symp->token; |
return symp->token; |
} |
} |
#if DEBUG |
#if DEBUG |
fprintf(stderr, "lex error:: \"%s\" is unknown symbol.\n", key); |
ox_printf("lex error:: \"%s\" is unknown symbol.\n", key); |
#endif |
#endif |
return 0; |
return 0; |
} |
} |
Line 739 static int lex_symbol() |
|
Line 741 static int lex_symbol() |
|
buffer[i]=c; |
buffer[i]=c; |
c = mygetc(); |
c = mygetc(); |
} |
} |
fprintf(stderr, "buffer overflow!\n"); |
ox_printf("buffer overflow!\n"); |
return 0; |
return 0; |
} |
} |
|
|
/* return する前に一文字先読みしておく. */ |
/* Remark: prefetching a character before return. */ |
static int lex() |
static int lex() |
{ |
{ |
int c_dash = 0; |
int c_dash = 0; |