diff --git a/examples/test.modal b/examples/test.modal index a34e4aa..449017b 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,4 +1,4 @@ -<> ([b]) () -<> (b) ([b]) +<> ([c]) () +<> (c) ([c]) (abc) \ No newline at end of file diff --git a/src/modal.c b/src/modal.c index a01e71e..8297ae9 100644 --- a/src/modal.c +++ b/src/modal.c @@ -11,7 +11,7 @@ static char bank_a[0x1000], *prog_ = bank_a; static char bank_b[0x1000], *outp_ = bank_b; static char *regs[0x100]; -#define spacer(c) (c == ' ' || c == '(' || c == ')') +#define spacer(c) (c == ' ' || c == '(' || c == ')' || c == 0) static char *parse_rulefrag(char *line); @@ -59,7 +59,7 @@ match(char *p, Rule *r) regs[id] = b; a++, b = walk(b), c = *b; } - if(!a[0] && spacer(*(b + 1))) return b; + if(!*a && spacer(*b)) return b; if(c != *b) return NULL; a++, b++; }