From 8fdfe1150a2155da5ea9d458adc347c4a6de5ce1 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Mon, 24 Jan 2022 11:41:31 -0500 Subject: Initial commit + start of lexer --- cup/utils.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 cup/utils.c (limited to 'cup/utils.c') diff --git a/cup/utils.c b/cup/utils.c new file mode 100644 index 0000000..3a586cd --- /dev/null +++ b/cup/utils.c @@ -0,0 +1,24 @@ +#include "utils.h" + +#include +#include +#include + +void die(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + exit(1); +} + +void die_location(Location loc, const char *fmt, ...) +{ + Location_print(stderr, loc); + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + exit(1); +} \ No newline at end of file -- cgit v1.2.3