return errors from parse()

* Create a sc_result struct that can contain errors as well as the parse results.
* Use sccount to report the found shortcodes instead of checking values
* Various Makefile and test-running fixes

Reviewed-on: #1
Co-authored-by: Roberto Alsina <roberto.alsina@gmail.com>
Co-committed-by: Roberto Alsina <roberto.alsina@gmail.com>
This commit is contained in:
2023-07-13 22:05:11 -03:00
committed by ralsina
parent 29d1e7ab2e
commit c0f4da86fe
6 changed files with 163 additions and 126 deletions

View File

@ -1,16 +1,13 @@
CC=tcc
all: tests
run: shortcodes
./shortcodes
CC=gcc
all: test
shortcodes.c: shortcodes.rl
ragel -G2 shortcodes.rl -o shortcodes.c
shortcodes: shortcodes.c
$(CC) shortcodes.c -g -o shortcodes
tests: shortcodes.c shortcodes.h tests.c
$(CC) tests.c shortcodes.c -lbg -lcgreen -g -o tests
test: tests
./tests
tests.so: shortcodes.c tests.c
$(CC) -fPIC -shared -g -o $@ $^ -lbg -lcgreen
clean:
rm -f shortcodes shortcodes.c
.PHONY: test run
rm -f shortcodes.c *.o *.so tests
test: tests.so
cgreen-runner $^
debug:
cgreen-debug tests.so
.PHONY: test debug