diff options
author | David Robillard <d@drobilla.net> | 2021-02-25 11:16:13 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 64024d0fa6a6dc048b2b846738846da597025f56 (patch) | |
tree | 7966dc76915aee1e4f284abe3685aa5b28e14dd3 /src/read_turtle.c | |
parent | 456bdeef35ffbfbdad7609e8b8a4ef71372786fd (diff) | |
download | serd-64024d0fa6a6dc048b2b846738846da597025f56.tar.gz serd-64024d0fa6a6dc048b2b846738846da597025f56.tar.bz2 serd-64024d0fa6a6dc048b2b846738846da597025f56.zip |
Leave statement caret at the start of literals
This allows a precise location to be reported for errors within literals, by
adding the offset of the error in the literal to the caret. This will be used
to report nice errors for things like regular expressions and supported XSD
datatypes.
Diffstat (limited to 'src/read_turtle.c')
-rw-r--r-- | src/read_turtle.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/read_turtle.c b/src/read_turtle.c index 027f0918..c3970a1e 100644 --- a/src/read_turtle.c +++ b/src/read_turtle.c @@ -13,6 +13,7 @@ #include "try.h" #include "turtle.h" +#include "serd/caret.h" #include "serd/node.h" #include "serd/reader.h" #include "serd/sink.h" @@ -610,6 +611,7 @@ read_object(SerdReader* const reader, bool* const ate_dot) { const size_t orig_stack_size = reader->stack.size; + SerdCaret orig_caret = reader->source->caret; assert(ctx->subject); @@ -660,6 +662,7 @@ read_object(SerdReader* const reader, break; case '\"': case '\'': + ++orig_caret.col; st = read_literal(reader, &o, ate_dot); break; default: @@ -668,7 +671,7 @@ read_object(SerdReader* const reader, } if (!st && simple && o) { - st = emit_statement(reader, *ctx, o); + st = emit_statement_at(reader, *ctx, o, &orig_caret); } serd_stack_pop_to(&reader->stack, orig_stack_size); |