aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/n3.c45
-rw-r--r--src/reader.h2
2 files changed, 17 insertions, 30 deletions
diff --git a/src/n3.c b/src/n3.c
index ccdd3b4b..75160f2d 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -712,7 +712,6 @@ read_0_9(SerdReader* reader, SerdNode* str, bool at_least_one)
static bool
read_number(SerdReader* reader,
SerdNode** dest,
- SerdNode** datatype,
SerdNodeFlags* flags,
bool* ate_dot)
{
@@ -763,14 +762,11 @@ read_number(SerdReader* reader,
default: break;
}
TRY_THROW(read_0_9(reader, ref, true));
- *datatype = push_node(reader, SERD_URI,
- XSD_DOUBLE, sizeof(XSD_DOUBLE) - 1);
+ push_node(reader, SERD_URI, XSD_DOUBLE, sizeof(XSD_DOUBLE) - 1);
} else if (has_decimal) {
- *datatype = push_node(reader, SERD_URI,
- XSD_DECIMAL, sizeof(XSD_DECIMAL) - 1);
+ push_node(reader, SERD_URI, XSD_DECIMAL, sizeof(XSD_DECIMAL) - 1);
} else {
- *datatype = push_node(reader, SERD_URI,
- XSD_INTEGER, sizeof(XSD_INTEGER) - 1);
+ push_node(reader, SERD_URI, XSD_INTEGER, sizeof(XSD_INTEGER) - 1);
}
*flags |= SERD_HAS_DATATYPE;
*dest = ref;
@@ -797,8 +793,6 @@ read_iri(SerdReader* reader, SerdNode** dest, bool* ate_dot)
static bool
read_literal(SerdReader* reader,
SerdNode** dest,
- SerdNode** datatype,
- SerdNode** lang,
SerdNodeFlags* flags,
bool* ate_dot)
{
@@ -807,24 +801,23 @@ read_literal(SerdReader* reader,
return false;
}
+ SerdNode* datatype = NULL;
switch (peek_byte(reader)) {
case '@':
eat_byte_safe(reader, '@');
*flags |= SERD_HAS_LANGUAGE;
- TRY_THROW(*lang = read_LANGTAG(reader));
+ TRY_THROW(read_LANGTAG(reader));
break;
case '^':
eat_byte_safe(reader, '^');
eat_byte_check(reader, '^');
*flags |= SERD_HAS_DATATYPE;
- TRY_THROW(read_iri(reader, datatype, ate_dot));
+ TRY_THROW(read_iri(reader, &datatype, ate_dot));
break;
}
*dest = str;
return true;
except:
- *datatype = NULL;
- *lang = NULL;
return r_err(reader, SERD_ERR_BAD_SYNTAX, "bad literal syntax\n");
}
@@ -996,13 +989,11 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot)
const size_t orig_stack_size = reader->stack.size;
- bool ret = false;
- bool simple = (ctx->subject != 0);
- SerdNode* o = 0;
- SerdNode* datatype = 0;
- SerdNode* lang = 0;
- uint32_t flags = 0;
- const uint8_t c = peek_byte(reader);
+ bool ret = false;
+ bool simple = (ctx->subject != 0);
+ SerdNode* o = 0;
+ uint32_t flags = 0;
+ const uint8_t c = peek_byte(reader);
if (!fancy_syntax(reader)) {
switch (c) {
case '"': case ':': case '<': case '_': break;
@@ -1029,11 +1020,11 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot)
break;
case '+': case '-': case '.': case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7': case '8': case '9':
- TRY_THROW(ret = read_number(reader, &o, &datatype, &flags, ate_dot));
+ TRY_THROW(ret = read_number(reader, &o, &flags, ate_dot));
break;
case '\"':
case '\'':
- TRY_THROW(ret = read_literal(reader, &o, &datatype, &lang, &flags, ate_dot));
+ TRY_THROW(ret = read_literal(reader, &o, &flags, ate_dot));
break;
default:
/* Either a boolean literal, or a qname. Read the prefix first, and if
@@ -1047,8 +1038,8 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot)
!memcmp(serd_node_get_string(o), "false", 5))) {
flags = flags | SERD_HAS_DATATYPE;
o->type = SERD_LITERAL;
- TRY_THROW(datatype = push_node(
- reader, SERD_URI, XSD_BOOLEAN, XSD_BOOLEAN_LEN));
+ TRY_THROW(
+ push_node(reader, SERD_URI, XSD_BOOLEAN, XSD_BOOLEAN_LEN));
ret = true;
} else if (read_PN_PREFIX_tail(reader, o) > SERD_FAILURE) {
ret = false;
@@ -1067,8 +1058,6 @@ read_object(SerdReader* reader, ReadContext* ctx, bool emit, bool* ate_dot)
ret = emit_statement(reader, *ctx, o);
} else if (ret && !emit) {
ctx->object = o;
- ctx->datatype = datatype;
- ctx->lang = lang;
return true;
}
@@ -1391,7 +1380,7 @@ bool
read_n3_statement(SerdReader* reader)
{
SerdStatementFlags flags = 0;
- ReadContext ctx = { 0, 0, 0, 0, 0, 0, &flags };
+ ReadContext ctx = { 0, 0, 0, 0, &flags };
SerdNode* subj = 0;
bool ate_dot = false;
char s_type = 0;
@@ -1489,7 +1478,7 @@ read_nquadsDoc(SerdReader* reader)
const size_t orig_stack_size = reader->stack.size;
SerdStatementFlags flags = 0;
- ReadContext ctx = { 0, 0, 0, 0, 0, 0, &flags };
+ ReadContext ctx = { 0, 0, 0, 0, &flags };
bool ate_dot = false;
char s_type = false;
read_ws_star(reader);
diff --git a/src/reader.h b/src/reader.h
index 234413a0..682e89a9 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -40,8 +40,6 @@ typedef struct {
SerdNode* subject;
SerdNode* predicate;
SerdNode* object;
- SerdNode* datatype;
- SerdNode* lang;
SerdStatementFlags* flags;
} ReadContext;