]> khamidou — GitHub mirrors - croma.git/commitdiff
refactoring...
authorkarim hamidou <karim@dar.(none)>
Fri, 24 Apr 2009 20:32:22 +0000 (22:32 +0200)
committerkarim hamidou <karim@dar.(none)>
Fri, 24 Apr 2009 20:32:22 +0000 (22:32 +0200)
macro.h
parse.c

diff --git a/macro.h b/macro.h
index 34cfbcad18fd9a7959213a157fc88566f2e8fc1c..a62ab23b2fbb1344fa717372f798886a1c9d1e2f 100644 (file)
--- a/macro.h
+++ b/macro.h
@@ -8,7 +8,14 @@
 #include "dynstring.h"
 
 
+/*
+  croma_arg is the structure representing a macro in memory.
+ */
+
+enum { T_STRING, T_ARG };
+
 struct croma_arg {
+       int type;       /*  T_STRING, T_ARG, ... */
        char *name;
        char *value;
        TAILQ_ENTRY(croma_arg) params;
diff --git a/parse.c b/parse.c
index d6b2a7b969eec5d3a25405259bb72f89f476c851..6216380f6cd3bf47842ac268ccb198adf8d32469 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -197,33 +197,12 @@ void parse_block(struct croma_block *b)
 
        int t = yylex();
 
-       while (t != RBRACKET && i < 8192) {
+       while (t != RBRACKET) {
                switch(t) {
                case WORD:
-                       defblock = lookup_symbol(yytext);
                        
-                       if (defblock != NULL) {
-                               struct croma_block *env = copy_block(defblock);
-                               if (env == NULL)
-                                       fail("Unable to allocate memory for macro environment");
-
-                               
-                               expect(LPAREN);
-
-                               struct croma_arg *a;
-                               TAILQ_FOREACH(a, &env->args_head, params) {
-                                       t = yylex();
-                                       if (t == RPAREN)
-                                               break;
-
-                                       a->value = strdup(yytext);
-                               }
-
-                               expand_macro(env);
-                       }
                }
-               strncat(s->contents, yytext, 8192 - i);
-               i += strlen(yytext);
+
                t = yylex();
        }