From b94dd665e3cc321a7deba7458fbb8cd1196d262c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 10 Feb 2019 10:59:20 +0100 Subject: Mostly working grammar --- src/sc2_test.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/sc2_test.c') diff --git a/src/sc2_test.c b/src/sc2_test.c index 5db89c4..6f9977f 100644 --- a/src/sc2_test.c +++ b/src/sc2_test.c @@ -25,18 +25,33 @@ #include #include #include +#include #include "storycode.tab.h" #include "storycode.h" +extern int scdebug; + int main(int argc, char *argv[]) { YY_BUFFER_STATE b; + GFile *file; + GBytes *bytes; + const char *text; + size_t len; + + file = g_file_new_for_uri("resource:///uk/me/bitwiz/Colloquium/demo.sc"); + bytes = g_file_load_bytes(file, NULL, NULL, NULL); + text = g_bytes_get_data(bytes, &len); + //scdebug = 1; printf("Here goes...\n"); - b = sc_scan_string("PRESTITLE: Hi there\nPRESTITLE: Second title\nSTYLES:\nPRESTITLE: three"); + b = sc_scan_string(text); scparse(); sc_delete_buffer(b); printf("Done.\n"); + + g_bytes_unref(bytes); + return 0; } -- cgit v1.2.3