"{{" { return LBRACKET; }
"}}" { return RBRACKET; }
"," { return COMMA; }
-"'" { return QUOTE; }
+"'"|"\\" { return QUOTE; }
"foreach" { return FOREACH; }
+"define" { return DEFINE; }
"$$" { return DOLDOL; }
[ \t\n]+ { return SPACES; }
-[a-zA-Z0-9,?!%*$^]+ { return WORD; }
+[a-zA-Z0-9,?!%*:;$^]+ { return WORD; }
TAILQ_ENTRY(croma_block) blocks;
};
+/*
+ blocks_head is our symbol tab.
+*/
+
TAILQ_HEAD(croma_blocks_head, croma_block) blocks_head;
/* this function inserts a block at the end of the queue.
"spaces",
"comma",
"quote",
- "foreach", NULL};
+ "foreach",
+ "define", NULL};
void expect(int t)
if (c != t) {
printf("c %d, t %d, yytext %s\n", c, t, yytext);
- fail("Expected token %s in input, got %s (at line %d).\n",
- token_list+t, token_list+c, yylineno);
+/* fail("Expected token %s in input, got %s (at line %d).\n",
+ token_list+t, token_list+c, yylineno); */
+ fail("EPIC FAIL\n");
}
}
case FOREACH:
foreach_expr();
break;
-
+
+ case DEFINE:
+ define_expr();
+ break;
+
default:
printf("%s", yytext);
}
free_block(b);
}
+void define_expr(void)
+{
+
+}
void parse_arglist(struct croma_block *b)
{
int i;
- expect(WORD);
+ int c = yylex();
+
+ if (c == RPAREN)
+ return;
/* FIXME : use realloc to implement infinite length parameter
lists
if (b->parameters[i] == NULL)
fail("Unable to alloc memory for text %s\n", yytext);
- int c = yylex();
+ c = yylex();
+
while (c == SPACES)
c = yylex();
enum {
LPAREN = 0, RPAREN, LBRACKET, RBRACKET, WORD, DOLDOL, SPACES, COMMA, QUOTE,
- FOREACH,
+ FOREACH, DEFINE,
};