Organized things a bit
This commit is contained in:
parent
41f7807cd6
commit
23e3fc2176
|
@ -10,13 +10,18 @@ A pattern/replacement can be:
|
|||
A variable: ?foo, ?bar, ?baz
|
||||
A sequence of the above: (foo bar baz), (foo ?bar baz), foo (bar (baz))
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
cc src/modal.c -o bin/modal
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```
|
||||
python3 ./modal.py
|
||||
bin/modal examples/hello.modal
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Created by [wryl](https://wryl.tech/), Immediate Mode Technologies.
|
||||
|
||||
|
|
4
makefile
4
makefile
|
@ -8,10 +8,10 @@ all: dest bin/modal
|
|||
dest:
|
||||
@ mkdir -p bin
|
||||
run: all
|
||||
@ bin/modal test.modal
|
||||
@ bin/modal examples/test.modal
|
||||
test: all
|
||||
@ bin/modal -v
|
||||
@ bin/modal test.modal
|
||||
@ bin/modal examples/test.modal
|
||||
install: all
|
||||
@ cp bin/modal ~/bin/
|
||||
uninstall:
|
||||
|
|
|
@ -19,8 +19,7 @@ walk(char *s)
|
|||
while((c = *s++)) {
|
||||
if(c == '(') depth++;
|
||||
if(c == ')') --depth;
|
||||
if(c == ' ' && !depth)
|
||||
break;
|
||||
if(c == ' ' && !depth) break;
|
||||
}
|
||||
return s - 1;
|
||||
}
|
||||
|
@ -55,6 +54,7 @@ static void
|
|||
save(void)
|
||||
{
|
||||
int i, end = outp_ - outp;
|
||||
/* todo: change pointer instead of copying memory */
|
||||
for(i = 0; i <= end; i++) prog[i] = outp[i];
|
||||
prog_ = prog, outp_ = outp;
|
||||
printf(".. %s\n", prog);
|
||||
|
@ -111,9 +111,7 @@ parse_rulefrag(FILE *f)
|
|||
while(f && fread(&c, 1, 1, f) && c && c != 0xa) {
|
||||
if(c == '(') depth++;
|
||||
if(c == ')') --depth;
|
||||
if(c == ' ' && !depth)
|
||||
break;
|
||||
else
|
||||
if(c == ' ' && !depth) break;
|
||||
*dict_++ = c;
|
||||
}
|
||||
*dict_++ = 0;
|
||||
|
|
Loading…
Reference in New Issue