Commit 5d276aaf06a18162749a6f0cdce90a359bb03c4e
1 parent
7ed76fa0
*** empty log message ***
Showing
1 changed file
with
25 additions
and
6 deletions
Show diff stats
anubis_dev/compiler/src/grammar_tools.c
| ... | ... | @@ -66,19 +66,38 @@ Expr string_to_tag(Expr s) |
| 66 | 66 | { |
| 67 | 67 | char *text = string_content(s); |
| 68 | 68 | |
| 69 | - if (0) return nil; | |
| 69 | +#ifdef commme_c_etait_avant | |
| 70 | + | |
| 70 | 71 | #define item(name) else if (!strcmp(text,#name)) return new_tag(ind_##name); |
| 71 | -#define sc_item(name,f) | |
| 72 | - tag_list | |
| 73 | -#undef item | |
| 74 | -#undef sc_item | |
| 75 | -#define item(name) | |
| 76 | 72 | #define sc_item(name,f) else if (!strcmp(text,#name)) return new_tag(ind_##name); |
| 77 | 73 | tag_list |
| 78 | 74 | #undef item |
| 79 | 75 | #undef sc_item |
| 80 | 76 | else internal_error("Unable to transform string into tag",s); |
| 81 | 77 | return nil; |
| 78 | + | |
| 79 | +#else | |
| 80 | + | |
| 81 | + int i; | |
| 82 | + char *tags_names_table[] = | |
| 83 | + { | |
| 84 | +#define item(name) #name, | |
| 85 | +#define sc_item(name,f) #name, | |
| 86 | + tag_list | |
| 87 | +#undef item | |
| 88 | +#undef sc_item | |
| 89 | + "dummy" | |
| 90 | + }; | |
| 91 | + | |
| 92 | + for (i = 0; i < ind_dummy; i++) | |
| 93 | + { | |
| 94 | + if (!strcmp(text,tags_names_table[i])) | |
| 95 | + return new_tag(i); | |
| 96 | + } | |
| 97 | + return nil; | |
| 98 | + | |
| 99 | +#endif | |
| 100 | + | |
| 82 | 101 | } |
| 83 | 102 | |
| 84 | 103 | ... | ... |