Catch empty rules

This commit is contained in:
Devine Lu Linvega 2024-05-10 14:25:54 -07:00
parent e80db68aa6
commit 4a57c3c564
2 changed files with 4 additions and 3 deletions

View File

@ -81,7 +81,8 @@ abc ?(?x) def = abc (lambda 2/2) test
<> (incomplete-basic)
<> (incomplete-reg ?x)
<> (waste-rule) *
<> <>
<> () ()
(incomplete-basic) = () (incomplete 1/4) test
(incomplete-reg abcdef) = () (incomplete 2/4) test

View File

@ -226,7 +226,7 @@ parse_frag(char **side, char *s)
{
char c, *cap;
while((c = *s) && c == ' ') s++;
if(c == ')' || (c == '<' || c == '>'))
if(c == ')' || c == '<' || c == '>' || (c == '(' && s[1] == ')'))
*side = NULL;
else {
cap = walk(s), *side = dict_;
@ -315,7 +315,7 @@ main(int argc, char **argv)
return !printf("usage: modal [-vqn] source.modal\n");
for(i = 1; i < argc && *argv[i] == '-'; i++) {
switch(argv[i][1]) {
case 'v': /* version */ return !printf("Modal Interpreter, 9 May 2024.\n");
case 'v': /* version */ return !printf("Modal Interpreter, 10 May 2024.\n");
case 'q': /* quiet */ quiet = 1; break;
case 'p': /* debug */ debug = 1; break;
case 'a': /* access */ access = 1; break;