diff options
Diffstat (limited to 'src/n3.c')
-rw-r--r-- | src/n3.c | 92 |
1 files changed, 1 insertions, 91 deletions
@@ -23,12 +23,6 @@ #include <stdio.h> #include <string.h> -static bool -fancy_syntax(const SerdReader* const reader) -{ - return reader->syntax == SERD_TURTLE || reader->syntax == SERD_TRIG; -} - static SerdStatus read_collection(SerdReader* reader, ReadContext ctx, SerdNode** dest); @@ -145,11 +139,6 @@ read_String(SerdReader* const reader, SerdNode* const node) return SERD_SUCCESS; } - if (!fancy_syntax(reader)) { - return r_err( - reader, SERD_BAD_SYNTAX, "syntax does not support long literals"); - } - skip_byte(reader, q3); return read_STRING_LITERAL_LONG(reader, node, (uint8_t)q1); } @@ -315,10 +304,6 @@ read_PN_PREFIX(SerdReader* const reader, SerdNode* const dest) static SerdStatus read_IRIREF(SerdReader* const reader, SerdNode** const dest) { - if (!fancy_syntax(reader)) { - return read_IRI(reader, dest); - } - SerdStatus st = SERD_SUCCESS; TRY(st, eat_byte_check(reader, '<')); @@ -589,17 +574,6 @@ read_object(SerdReader* const reader, bool simple = (ctx->subject != 0); SerdNode* o = 0; const int c = peek_byte(reader); - if (!fancy_syntax(reader)) { - switch (c) { - case '"': - case ':': - case '<': - case '_': - break; - default: - return r_err(reader, SERD_BAD_SYNTAX, "expected: ':', '<', or '_'"); - } - } switch (c) { case EOF: @@ -672,11 +646,9 @@ read_object(SerdReader* const reader, } } + ctx->object = o; if (!st && emit && simple && o) { st = emit_statement(reader, *ctx, o); - } else if (!st && !emit) { - ctx->object = o; - return SERD_SUCCESS; } serd_stack_pop_to(&reader->stack, orig_stack_size); @@ -1128,65 +1100,3 @@ read_turtleTrigDoc(SerdReader* const reader) return SERD_SUCCESS; } - -SerdStatus -read_nquads_statement(SerdReader* const reader) -{ - SerdStatus st = SERD_SUCCESS; - SerdStatementFlags flags = 0; - ReadContext ctx = {0, 0, 0, 0, &flags}; - bool ate_dot = false; - int s_type = 0; - - read_ws_star(reader); - if (peek_byte(reader) == EOF) { - return SERD_FAILURE; - } - - if (peek_byte(reader) == '@') { - return r_err(reader, SERD_BAD_SYNTAX, "syntax does not support directives"); - } - - // subject predicate object - if ((st = read_subject(reader, ctx, &ctx.subject, &s_type)) || - !read_ws_star(reader) || (st = read_IRIREF(reader, &ctx.predicate)) || - !read_ws_star(reader) || - (st = read_object(reader, &ctx, false, &ate_dot))) { - return st; - } - - if (!ate_dot) { // graphLabel? - read_ws_star(reader); - switch (peek_byte(reader)) { - case '.': - break; - case '_': - TRY(st, read_BLANK_NODE_LABEL(reader, &ctx.graph, &ate_dot)); - break; - default: - TRY(st, read_IRIREF(reader, &ctx.graph)); - } - - // Terminating '.' - read_ws_star(reader); - TRY(st, eat_byte_check(reader, '.')); - } - - return emit_statement(reader, ctx, ctx.object); -} - -SerdStatus -read_nquadsDoc(SerdReader* const reader) -{ - SerdStatus st = SERD_SUCCESS; - - while (!reader->source.eof && !st) { - const size_t orig_stack_size = reader->stack.size; - - st = read_nquads_statement(reader); - - serd_stack_pop_to(&reader->stack, orig_stack_size); - } - - return st; -} |