diff --git a/makefile b/makefile index 297bc15..4688cf0 100644 --- a/makefile +++ b/makefile @@ -8,11 +8,11 @@ all: dest dest: @ mkdir -p bin run: all bin/modal - @ bin/modal examples/hello.modal 2> /dev/null + @ bin/modal examples/hello.modal test: bin/modal-debug bin/modal @ bin/modal -v @ bin/modal-debug examples/test.modal "(arg1) (arg2 (arg3))" - @ time bin/modal examples/test.modal "(arg1) (arg2 (arg3))" + @ time bin/modal examples/test.modal 2> /dev/null install: bin/modal cp bin/modal ~/bin/ uninstall: diff --git a/src/modal.c b/src/modal.c index 560d51a..73f7656 100644 --- a/src/modal.c +++ b/src/modal.c @@ -35,13 +35,14 @@ plode(char *s) { int i, depth = 0; char c, *ss; - if(s[0] == '(') { /* implode */ + /* implode */ + if(s[0] == '(') { ss = walk(s); - while(s < ss) { - c = *(s++); + while(s < ss && (c = *(s++))) if(!spacer(c)) *outp_++ = c; - } - } else { /* explode */ + } + /* explode */ + else { while((c = *s++) && !spacer(c)) *outp_++ = c, *outp_++ = ' ', *outp_++ = '(', depth++; for(i = 0; i < depth; i++)