diff options
author | David Robillard <d@drobilla.net> | 2021-02-25 11:16:13 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-14 19:37:51 -0500 |
commit | 4436f80225c441a878c4baf856d21dee0394c8dc (patch) | |
tree | 707757fd8544595a8c6fa423c72e7a5fe5c2d6be /src/n3.c | |
parent | 17003e707a3368a029dd8c0e7bdf98979f691daf (diff) | |
download | serd-4436f80225c441a878c4baf856d21dee0394c8dc.tar.gz serd-4436f80225c441a878c4baf856d21dee0394c8dc.tar.bz2 serd-4436f80225c441a878c4baf856d21dee0394c8dc.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/n3.c')
-rw-r--r-- | src/n3.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -15,6 +15,7 @@ */ #include "byte_source.h" +#include "caret.h" #include "env.h" #include "namespaces.h" #include "node.h" @@ -732,6 +733,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); @@ -782,6 +784,7 @@ read_object(SerdReader* const reader, break; case '\"': case '\'': + ++orig_caret.col; st = read_literal(reader, &o, ate_dot); break; default: @@ -790,7 +793,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); |