Fixed issue with lambda
This commit is contained in:
parent
3b415e52da
commit
ad4738bce1
4
makefile
4
makefile
|
@ -8,11 +8,11 @@ all: dest
|
||||||
dest:
|
dest:
|
||||||
@ mkdir -p bin
|
@ mkdir -p bin
|
||||||
run: all bin/modal
|
run: all bin/modal
|
||||||
@ bin/modal examples/hello.modal
|
@ bin/modal examples/hello.modal 2> /dev/null
|
||||||
test: bin/modal-debug bin/modal
|
test: bin/modal-debug bin/modal
|
||||||
@ bin/modal -v
|
@ bin/modal -v
|
||||||
@ bin/modal-debug examples/test.modal "(arg1) (arg2 (arg3))"
|
@ bin/modal-debug examples/test.modal "(arg1) (arg2 (arg3))"
|
||||||
@ time bin/modal examples/test.modal 2> /dev/null
|
@ bin/modal examples/test.modal
|
||||||
install: bin/modal
|
install: bin/modal
|
||||||
cp bin/modal ~/bin/
|
cp bin/modal ~/bin/
|
||||||
uninstall:
|
uninstall:
|
||||||
|
|
|
@ -164,7 +164,7 @@ create_rule(Rule *r, int id, char *s)
|
||||||
static int
|
static int
|
||||||
rewrite(void)
|
rewrite(void)
|
||||||
{
|
{
|
||||||
char c, last = 0, *s = dst ? bank_b : bank_a, *res;
|
char c, last = 0, *cap, *s = dst ? bank_b : bank_a, *res;
|
||||||
while((c = *s) && c <= ' ') s++;
|
while((c = *s) && c <= ' ') s++;
|
||||||
while((c = *s)) {
|
while((c = *s)) {
|
||||||
if(spacer(last)) {
|
if(spacer(last)) {
|
||||||
|
@ -175,8 +175,8 @@ rewrite(void)
|
||||||
return commit_rule(r, s, 1);
|
return commit_rule(r, s, 1);
|
||||||
}
|
}
|
||||||
if(s[0] == '?' && s[1] == '(') {
|
if(s[0] == '?' && s[1] == '(') {
|
||||||
r = λ
|
cap = walk(s+1);
|
||||||
s = create_rule(&lambda, -1, s) + 1;
|
r = &lambda, create_rule(&lambda, -1, s), s = cap;
|
||||||
while((c = *s) && c <= ' ') s++;
|
while((c = *s) && c <= ' ') s++;
|
||||||
if((res = match_rule(&lambda, s)) != NULL)
|
if((res = match_rule(&lambda, s)) != NULL)
|
||||||
return write_rule(&lambda, last, res);
|
return write_rule(&lambda, last, res);
|
||||||
|
|
Loading…
Reference in New Issue