Fixes issue with trailing ws

This commit is contained in:
Devine Lu Linvega 2024-04-17 11:40:47 -07:00
parent 88649fce12
commit 7a93de35ad
3 changed files with 6 additions and 2 deletions

View File

@ -15,9 +15,11 @@ nap tap test
<> (?x pop-plain)
<> (?x pop) ()
<> (ghost) ()
abc def pop-plain = abc test
abc def pop = abc test
(ghost) = ()
?(?-) (Basic replacements)

View File

@ -1,7 +1,7 @@
RELEASE_flags=-DNDEBUG -O2 -g0 -s
DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined
.PHONY: all debug dest run test install uninstall format clean archive
.PHONY: all debug dest run debug test install uninstall format clean archive
all: dest
@ -9,6 +9,8 @@ dest:
@ mkdir -p bin
run: all bin/modal
@ bin/modal examples/hello.modal 2> /dev/null
debug: bin/modal-debug
@ bin/modal-debug examples/hello.modal
test: bin/modal-debug bin/modal
@ bin/modal -v
@ bin/modal-debug examples/tests.modal

View File

@ -147,8 +147,8 @@ write_rule(Rule *r, char last, char *res)
else
*dst_++ = c, last = c;
if(dst_ == origin) {
if(*res == ')') dst_--;
while(*res == ' ') res++;
if(*res == ')' && *(dst_ - 1) == ' ') dst_--;
}
return commit_rule(r, res, 0);
}