From 9b1139fe7045a0630e87501235af21803860b80c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 1 Dec 2023 21:59:18 -0500 Subject: [WIP] Add support for reading and writing variables [WIP] Command line option, move later? This adds a reader flag and serdi option for extending a syntax with support for SPARQL-like variables, for storing things like patterns or simple queries. --- tools/serd-pipe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools/serd-pipe.c') diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c index 480afa6e..b09c12e1 100644 --- a/tools/serd-pipe.c +++ b/tools/serd-pipe.c @@ -51,7 +51,8 @@ print_usage(const char* const name, const bool error) " -r ROOT_URI Keep relative URIs within ROOT_URI.\n" " -s STRING Parse STRING as input.\n" " -t Write terser output without newlines.\n" - " -v Display version information and exit.\n"; + " -v Display version information and exit.\n" + " -x Support parsing variable nodes like \"?x\".\n"; FILE* const os = error ? stderr : stdout; fprintf(os, "%s", error ? "\n" : ""); @@ -161,6 +162,9 @@ main(int argc, char** argv) writer_flags |= SERD_WRITE_TERSE; } else if (opt == 'v') { return serd_print_version(argv[0]); + } else if (opt == 'x') { + reader_flags |= SERD_READ_VARIABLES; + break; } else if (argv[a][1] == 'B') { if (++a == argc) { return missing_arg(prog, 'B'); -- cgit v1.2.1