diff options
-rw-r--r-- | dm.c | 2 | ||||
-rw-r--r-- | dm_parser.c | 20 | ||||
-rw-r--r-- | dm_parser.ragel | 6 | ||||
-rw-r--r-- | syntax.c | 4 | ||||
-rw-r--r-- | tokenizer.c | 8 |
5 files changed, 12 insertions, 28 deletions
@@ -72,7 +72,7 @@ int ast2tb( ast_root *ast, mt_table *mt ) /*****************************************************************************/ /* primitive matchin for loop, get table sorted then more advanced solution * maycome */ -int match( mt_table *mt, unsigned char *buf, size_t size ) +int match( mt_table *mt, char *buf, size_t size ) { //anonymouse function int pr(char *str, int sz) diff --git a/dm_parser.c b/dm_parser.c index bfd829f..f91eec9 100644 --- a/dm_parser.c +++ b/dm_parser.c @@ -120,7 +120,7 @@ int parse_dm( token_list *tl, const char *str ) { static uint8_t cs; const int stacksize = 10; - int res=0, *top=0, *stack=NULL, act=0; + int res=0, *stack=NULL, act=0; stack = malloc( sizeof(stack)*stacksize ); char *p=(char *)str, *pe = (char *)str + strlen( str ), *eof=NULL; char *ts, *te = 0; @@ -128,13 +128,9 @@ int parse_dm( token_list *tl, const char *str ) /* variables used in state machine */ - char *token_s=NULL, *token_e=NULL; - char *value_s=NULL, *value_e=NULL; - int token_type=0; - int dm_current_tok = TOK_NONE; -#line 138 "dm_parser.c" +#line 134 "dm_parser.c" { cs = dm_start; ts = 0; @@ -142,9 +138,9 @@ int parse_dm( token_list *tl, const char *str ) act = 0; } -#line 83 "dm_parser.ragel" +#line 79 "dm_parser.ragel" -#line 148 "dm_parser.c" +#line 144 "dm_parser.c" { int _klen; unsigned int _trans; @@ -165,7 +161,7 @@ _resume: #line 1 "NONE" {ts = p;} break; -#line 169 "dm_parser.c" +#line 165 "dm_parser.c" } } @@ -275,7 +271,7 @@ _eof_trans: #line 54 "dm_parser.ragel" {{p = ((te))-1;}{/*printf("int = ");fwrite(ts,1,te-ts,stdout);printf("\n");*/TADD(TOK_INT,ts,te);}} break; -#line 279 "dm_parser.c" +#line 275 "dm_parser.c" } } @@ -288,7 +284,7 @@ _again: #line 1 "NONE" {ts = 0;} break; -#line 292 "dm_parser.c" +#line 288 "dm_parser.c" } } @@ -308,7 +304,7 @@ _again: _out: {} } -#line 84 "dm_parser.ragel" +#line 80 "dm_parser.ragel" if ( cs == dm_error ) { diff --git a/dm_parser.ragel b/dm_parser.ragel index 80c873b..735b2fd 100644 --- a/dm_parser.ragel +++ b/dm_parser.ragel @@ -66,7 +66,7 @@ int parse_dm( token_list *tl, const char *str ) { static uint8_t cs; const int stacksize = 10; - int res=0, *top=0, *stack=NULL, act=0; + int res=0, *stack=NULL, act=0; stack = malloc( sizeof(stack)*stacksize ); char *p=(char *)str, *pe = (char *)str + strlen( str ), *eof=NULL; char *ts, *te = 0; @@ -74,10 +74,6 @@ int parse_dm( token_list *tl, const char *str ) /* variables used in state machine */ - char *token_s=NULL, *token_e=NULL; - char *value_s=NULL, *value_e=NULL; - int token_type=0; - int dm_current_tok = TOK_NONE; %%write init; %%write exec; @@ -212,7 +212,7 @@ ast_expr_cmp* att_expr_cmp( token_list *tl, int pos ) /*****************************************************************************/ ast_expr_bit* att_expr_bit( token_list *tl, int pos ) { - + return NULL; } /*****************************************************************************/ @@ -429,7 +429,7 @@ int ate_a_cmp( ast_expr **expr, ast_expr_cmp *cmp ) /*****************************************************************************/ int ate_eval( ast_expr *expr ) { - + return -1; } diff --git a/tokenizer.c b/tokenizer.c index a7c73e2..f69d404 100644 --- a/tokenizer.c +++ b/tokenizer.c @@ -80,13 +80,7 @@ int tl_add_tok( token_list *tl, int t, char *s, char *e ) /*****************************************************************************/ char* tl_str( token_list *tl ) { - int len = 128; - int p = 0; - char *s = NULL; int i = 0; - //s = malloc( len ); - //s[p] = 0; - for (i=0; i<darr_end(tl->list); i++) { @@ -98,8 +92,6 @@ char* tl_str( token_list *tl ) } } - return s; -error: return NULL; } |