aboutsummaryrefslogtreecommitdiffstats
path: root/src/serdi.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-18 19:09:49 -0500
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commitfc3e5a0a7c9c64d275fec498f0e80dc02444c12d (patch)
tree538ab16491a4726431233fe22b2cd08b001281c6 /src/serdi.c
parentb7948f8c9ad54c30e2579fd5da4626c6f3de325a (diff)
downloadserd-fc3e5a0a7c9c64d275fec498f0e80dc02444c12d.tar.gz
serd-fc3e5a0a7c9c64d275fec498f0e80dc02444c12d.tar.bz2
serd-fc3e5a0a7c9c64d275fec498f0e80dc02444c12d.zip
Add support for parsing variables
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.
Diffstat (limited to 'src/serdi.c')
-rw-r--r--src/serdi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 1925cd88..2801a2da 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -72,6 +72,7 @@ print_usage(const char* name, bool error)
fprintf(os, " -s INPUT Parse INPUT as string.\n");
fprintf(os, " -t Write terser output without newlines.\n");
fprintf(os, " -v Display version information and exit.\n");
+ fprintf(os, " -x Support parsing variable nodes like `?x'.\n");
return error ? 1 : 0;
}
@@ -246,6 +247,8 @@ main(int argc, char** argv)
return missing_arg(argv[0], 'w');
}
out_filename = argv[a];
+ } else if (argv[a][1] == 'x') {
+ reader_flags |= SERD_READ_VARIABLES;
} else {
SERDI_ERRORF("invalid option -- '%s'\n", argv[a] + 1);
return print_usage(argv[0], true);