aboutsummaryrefslogtreecommitdiffstats
path: root/src/n3.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-05 10:34:37 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 16:27:02 -0500
commitfebb30141356df83a56026bbb14099e3cb2c82fc (patch)
treef1d2abcdc3872e375ffe8e4138a8043c20b3b1a8 /src/n3.c
parentb739848b6ea4c038610ceb7c0b00984a86d99fa9 (diff)
downloadserd-febb30141356df83a56026bbb14099e3cb2c82fc.tar.gz
serd-febb30141356df83a56026bbb14099e3cb2c82fc.tar.bz2
serd-febb30141356df83a56026bbb14099e3cb2c82fc.zip
Use more human-readable status codes
Diffstat (limited to 'src/n3.c')
-rw-r--r--src/n3.c154
1 files changed, 73 insertions, 81 deletions
diff --git a/src/n3.c b/src/n3.c
index f808e74a..b7b89342 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -50,7 +50,7 @@ read_HEX(SerdReader* const reader)
return (uint8_t)eat_byte_safe(reader, c);
}
- r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid hexadecimal digit '%c'\n", c);
+ r_err(reader, SERD_BAD_SYNTAX, "invalid hexadecimal digit '%c'\n", c);
return 0;
}
@@ -68,7 +68,7 @@ read_UCHAR(SerdReader* const reader, const Ref dest, uint32_t* const char_code)
length = 4;
break;
default:
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
skip_byte(reader, b);
@@ -78,7 +78,7 @@ read_UCHAR(SerdReader* const reader, const Ref dest, uint32_t* const char_code)
uint32_t code = 0U;
for (unsigned i = 0U; i < length; ++i) {
if (!(buf[i] = read_HEX(reader))) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
code = (code << (i ? 4U : 0U)) | hex_digit_value(buf[i]);
@@ -95,10 +95,8 @@ read_UCHAR(SerdReader* const reader, const Ref dest, uint32_t* const char_code)
} else if (code < 0x00110000) {
size = 4;
} else {
- r_err(reader,
- SERD_ERR_BAD_SYNTAX,
- "unicode character 0x%X out of range\n",
- code);
+ r_err(
+ reader, SERD_BAD_SYNTAX, "unicode character 0x%X out of range\n", code);
push_bytes(reader, dest, replacement_char, 3);
*char_code = 0xFFFD;
return SERD_SUCCESS;
@@ -159,7 +157,7 @@ read_ECHAR(SerdReader* const reader, const Ref dest, SerdNodeFlags* const flags)
case '\'':
return push_byte(reader, dest, eat_byte_safe(reader, c));
default:
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
}
@@ -172,8 +170,8 @@ bad_char(SerdReader* const reader, const char* const fmt, const uint8_t c)
b = peek_byte(reader);
}
- r_err(reader, SERD_ERR_BAD_SYNTAX, fmt, c);
- return reader->strict ? SERD_ERR_BAD_SYNTAX : SERD_FAILURE;
+ r_err(reader, SERD_BAD_SYNTAX, fmt, c);
+ return reader->strict ? SERD_BAD_SYNTAX : SERD_FAILURE;
}
static SerdStatus
@@ -368,7 +366,7 @@ read_STRING_LITERAL_LONG(SerdReader* const reader,
st = read_character(reader, ref, flags, (uint8_t)q2);
}
} else if (c == EOF) {
- st = r_err(reader, SERD_ERR_BAD_SYNTAX, "end of file in long string\n");
+ st = r_err(reader, SERD_BAD_SYNTAX, "end of file in long string\n");
} else {
st =
read_character(reader, ref, flags, (uint8_t)eat_byte_safe(reader, c));
@@ -392,11 +390,10 @@ read_STRING_LITERAL(SerdReader* const reader,
const int c = peek_byte(reader);
switch (c) {
case EOF:
- return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "end of file in short string\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "end of file in short string\n");
case '\n':
case '\r':
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "line end in short string\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "line end in short string\n");
case '\\':
skip_byte(reader, c);
TRY(st, read_string_escape(reader, ref, flags));
@@ -411,7 +408,7 @@ read_STRING_LITERAL(SerdReader* const reader,
}
}
- return eat_byte_check(reader, q) ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX;
+ return eat_byte_check(reader, q) ? SERD_SUCCESS : SERD_BAD_SYNTAX;
}
static SerdStatus
@@ -422,7 +419,7 @@ read_String(SerdReader* const reader,
const int q1 = eat_byte_safe(reader, peek_byte(reader));
const int q2 = peek_byte(reader);
if (q2 == EOF) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of file\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "unexpected end of file\n");
}
if (q2 != q1) { // Short string (not triple quoted)
@@ -432,7 +429,7 @@ read_String(SerdReader* const reader,
skip_byte(reader, q2);
const int q3 = peek_byte(reader);
if (q3 == EOF) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of file\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "unexpected end of file\n");
}
if (q3 != q1) { // Empty short string ("" or '')
@@ -441,7 +438,7 @@ read_String(SerdReader* const reader,
if (!fancy_syntax(reader)) {
return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "syntax does not support long literals\n");
+ reader, SERD_BAD_SYNTAX, "syntax does not support long literals\n");
}
skip_byte(reader, q3);
@@ -478,10 +475,9 @@ read_PN_CHARS_BASE(SerdReader* const reader, const Ref dest)
read_utf8_code(reader, dest, &code, (uint8_t)c);
if (!is_PN_CHARS_BASE(code)) {
- r_err(
- reader, SERD_ERR_BAD_SYNTAX, "invalid character U+%04X in name\n", code);
+ r_err(reader, SERD_BAD_SYNTAX, "invalid character U+%04X in name\n", code);
if (reader->strict) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
}
@@ -515,7 +511,7 @@ read_PN_CHARS(SerdReader* const reader, const Ref dest)
if (!is_PN_CHARS(code)) {
return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "invalid character U+%04X in name\n", code);
+ reader, SERD_BAD_SYNTAX, "invalid character U+%04X in name\n", code);
}
return st;
@@ -532,7 +528,7 @@ read_PERCENT(SerdReader* const reader, const Ref dest)
return push_byte(reader, dest, h2);
}
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
static SerdStatus
@@ -565,7 +561,7 @@ read_PN_LOCAL_ESC(SerdReader* const reader, const Ref dest)
push_byte(reader, dest, eat_byte_safe(reader, c));
break;
default:
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid escape\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid escape\n");
}
return SERD_SUCCESS;
@@ -620,7 +616,7 @@ read_PN_LOCAL(SerdReader* const reader, const Ref dest, bool* const ate_dot)
if (c == '.' || c == ':') {
push_byte(reader, dest, eat_byte_safe(reader, c));
} else if ((st = read_PLX(reader, dest)) > SERD_FAILURE) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "bad escape\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "bad escape\n");
} else if (st != SERD_SUCCESS && (st = read_PN_CHARS(reader, dest))) {
break;
}
@@ -653,7 +649,7 @@ read_PN_PREFIX_tail(SerdReader* const reader, const Ref dest)
const SerdNode* const n = deref(reader, dest);
if (n->buf[n->n_bytes - 1] == '.' && read_PN_CHARS(reader, dest)) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "prefix ends with '.'\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "prefix ends with '.'\n");
}
return SERD_SUCCESS;
@@ -672,7 +668,7 @@ read_LANGTAG(SerdReader* const reader, Ref* const dest)
{
int c = peek_byte(reader);
if (!is_alpha(c)) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected '%c'\n", c);
+ return r_err(reader, SERD_BAD_SYNTAX, "unexpected '%c'\n", c);
}
*dest = push_node(reader, SERD_LITERAL, "", 0);
@@ -698,17 +694,17 @@ read_IRIREF_scheme(SerdReader* const reader, const Ref dest)
{
int c = peek_byte(reader);
if (!is_alpha(c)) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "bad IRI scheme start '%c'\n", c);
+ return r_err(reader, SERD_BAD_SYNTAX, "bad IRI scheme start '%c'\n", c);
}
while ((c = peek_byte(reader)) != EOF) {
if (c == '>') {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "missing IRI scheme\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "missing IRI scheme\n");
}
if (!is_uri_scheme_char(c)) {
return r_err(reader,
- SERD_ERR_BAD_SYNTAX,
+ SERD_BAD_SYNTAX,
"bad IRI scheme char U+%04X (%c)\n",
(unsigned)c,
(char)c);
@@ -720,21 +716,21 @@ read_IRIREF_scheme(SerdReader* const reader, const Ref dest)
}
}
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of file\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "unexpected end of file\n");
}
static SerdStatus
read_IRIREF(SerdReader* const reader, Ref* const dest)
{
if (!eat_byte_check(reader, '<')) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
*dest = push_node(reader, SERD_URI, "", 0);
if (!fancy_syntax(reader) && read_IRIREF_scheme(reader, *dest)) {
*dest = pop_node(reader, *dest);
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected IRI scheme\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected IRI scheme\n");
}
SerdStatus st = SERD_SUCCESS;
@@ -745,8 +741,7 @@ read_IRIREF(SerdReader* const reader, Ref* const dest)
case '"':
case '<':
*dest = pop_node(reader, *dest);
- return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "invalid IRI character '%c'\n", c);
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid IRI character '%c'\n", c);
case '>':
return SERD_SUCCESS;
@@ -754,7 +749,7 @@ read_IRIREF(SerdReader* const reader, Ref* const dest)
case '\\':
if (read_UCHAR(reader, *dest, &code)) {
*dest = pop_node(reader, *dest);
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid IRI escape\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid IRI escape\n");
}
switch (code) {
@@ -764,7 +759,7 @@ read_IRIREF(SerdReader* const reader, Ref* const dest)
case '>':
*dest = pop_node(reader, *dest);
return r_err(reader,
- SERD_ERR_BAD_SYNTAX,
+ SERD_BAD_SYNTAX,
"invalid escaped IRI character U+%04X\n",
code);
default:
@@ -778,13 +773,12 @@ read_IRIREF(SerdReader* const reader, Ref* const dest)
case '|':
case '}':
*dest = pop_node(reader, *dest);
- return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "invalid IRI character '%c'\n", c);
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid IRI character '%c'\n", c);
default:
if (c <= 0x20) {
st = r_err(reader,
- SERD_ERR_BAD_SYNTAX,
+ SERD_BAD_SYNTAX,
"invalid IRI character (escape %%%02X)\n",
(unsigned)c);
if (reader->strict) {
@@ -798,7 +792,7 @@ read_IRIREF(SerdReader* const reader, Ref* const dest)
} else if (read_utf8_character(reader, *dest, (uint8_t)c)) {
if (reader->strict) {
*dest = pop_node(reader, *dest);
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
}
}
@@ -839,7 +833,7 @@ read_0_9(SerdReader* const reader, const Ref str, const bool at_least_one)
}
if (at_least_one && count == 0) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected digit\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected digit\n");
}
return SERD_SUCCESS;
@@ -952,7 +946,7 @@ read_literal(SerdReader* const reader,
case '^':
skip_byte(reader, '^');
if (!eat_byte_check(reader, '^')) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected '^'\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected '^'\n");
}
if ((st = read_iri(reader, datatype, ate_dot))) {
@@ -993,7 +987,7 @@ read_verb(SerdReader* const reader, Ref* const dest)
if (st > SERD_FAILURE ||
(st = read_PrefixedName(reader, *dest, false, &ate_dot)) || ate_dot) {
*dest = pop_node(reader, *dest);
- st = st > SERD_FAILURE ? st : SERD_ERR_BAD_SYNTAX;
+ st = st > SERD_FAILURE ? st : SERD_BAD_SYNTAX;
return r_err(reader, st, "bad verb\n");
}
@@ -1007,7 +1001,7 @@ read_BLANK_NODE_LABEL(SerdReader* const reader,
{
skip_byte(reader, '_');
if (!eat_byte_check(reader, ':')) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
const Ref ref = *dest = push_node(reader,
@@ -1020,7 +1014,7 @@ read_BLANK_NODE_LABEL(SerdReader* const reader,
push_byte(reader, ref, eat_byte_safe(reader, c));
} else if (read_PN_CHARS(reader, ref)) {
*dest = pop_node(reader, *dest);
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid name start\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid name start\n");
}
while ((c = peek_byte(reader))) { // Middle: (PN_CHARS | '.')*
@@ -1047,7 +1041,7 @@ read_BLANK_NODE_LABEL(SerdReader* const reader,
} else if (reader->seen_genid && n->buf[reader->bprefix_len] == 'B') {
*dest = pop_node(reader, *dest);
return r_err(reader,
- SERD_ERR_ID_CLASH,
+ SERD_BAD_LABEL,
"found both 'b' and 'B' blank IDs, prefix required\n");
}
}
@@ -1094,7 +1088,7 @@ read_anon(SerdReader* const reader,
TRY_FAILING(st, read_predicateObjectList(reader, ctx, &ate_dot_in_list));
if (ate_dot_in_list) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "'.' inside blank\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "'.' inside blank\n");
}
read_ws_star(reader);
@@ -1107,7 +1101,7 @@ read_anon(SerdReader* const reader,
return st > SERD_FAILURE ? st
: (eat_byte_check(reader, ']') == ']') ? SERD_SUCCESS
- : SERD_ERR_BAD_SYNTAX;
+ : SERD_BAD_SYNTAX;
}
/* If emit is true: recurses, calling statement_sink for every statement
@@ -1143,13 +1137,13 @@ read_object(SerdReader* const reader,
case '_':
break;
default:
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected: ':', '<', or '_'\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected: ':', '<', or '_'\n");
}
}
switch (c) {
case EOF:
case ')':
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected object\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected object\n");
case '[':
simple = false;
st = read_anon(reader, *ctx, false, &o);
@@ -1198,10 +1192,10 @@ read_object(SerdReader* const reader,
datatype = push_node(reader, SERD_URI, XSD_BOOLEAN, XSD_BOOLEAN_LEN);
st = SERD_SUCCESS;
} else if (read_PN_PREFIX_tail(reader, o) > SERD_FAILURE) {
- st = SERD_ERR_BAD_SYNTAX;
+ st = SERD_BAD_SYNTAX;
} else {
if ((st = read_PrefixedName(reader, o, false, ate_dot))) {
- st = st > SERD_FAILURE ? st : SERD_ERR_BAD_SYNTAX;
+ st = st > SERD_FAILURE ? st : SERD_BAD_SYNTAX;
pop_node(reader, o);
return r_err(reader, st, "expected prefixed name\n");
}
@@ -1237,7 +1231,7 @@ read_objectList(SerdReader* const reader, ReadContext ctx, bool* const ate_dot)
TRY(st, read_object(reader, &ctx, true, ate_dot));
if (!fancy_syntax(reader) && peek_delim(reader, ',')) {
return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "syntax does not support abbreviation\n");
+ reader, SERD_BAD_SYNTAX, "syntax does not support abbreviation\n");
}
while (!*ate_dot && eat_delim(reader, ',')) {
@@ -1266,7 +1260,7 @@ read_predicateObjectList(SerdReader* const reader,
read_ws_star(reader);
switch (c = peek_byte(reader)) {
case EOF:
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of file\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "unexpected end of file\n");
case '.':
case ']':
case '}':
@@ -1278,7 +1272,7 @@ read_predicateObjectList(SerdReader* const reader,
} while (c == ';');
if (!ate_semi) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "missing ';' or '.'\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "missing ';' or '.'\n");
}
}
@@ -1298,7 +1292,7 @@ end_collection(SerdReader* const reader,
*ctx.flags &= ~(unsigned)SERD_LIST_CONT;
if (!st) {
return (eat_byte_check(reader, ')') == ')') ? SERD_SUCCESS
- : SERD_ERR_BAD_SYNTAX;
+ : SERD_BAD_SYNTAX;
}
return st;
@@ -1389,7 +1383,7 @@ read_subject(SerdReader* const reader,
if (ate_dot) {
pop_node(reader, *dest);
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "subject ends with '.'\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "subject ends with '.'\n");
}
return st;
@@ -1404,7 +1398,7 @@ read_labelOrSubject(SerdReader* const reader, Ref* const dest)
skip_byte(reader, '[');
read_ws_star(reader);
if (!eat_byte_check(reader, ']')) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
*dest = blank_id(reader);
return SERD_SUCCESS;
@@ -1414,7 +1408,7 @@ read_labelOrSubject(SerdReader* const reader, Ref* const dest)
if (!read_iri(reader, dest, &ate_dot)) {
return SERD_SUCCESS;
} else {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected label or subject\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected label or subject\n");
}
}
}
@@ -1458,11 +1452,11 @@ read_base(SerdReader* const reader, const bool sparql, const bool token)
read_ws_star(reader);
if (!sparql) {
- return eat_byte_check(reader, '.') ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX;
+ return eat_byte_check(reader, '.') ? SERD_SUCCESS : SERD_BAD_SYNTAX;
}
if (peek_byte(reader) == '.') {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "full stop after SPARQL BASE\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "full stop after SPARQL BASE\n");
}
return SERD_SUCCESS;
@@ -1482,7 +1476,7 @@ read_prefixID(SerdReader* const reader, const bool sparql, const bool token)
if (eat_byte_check(reader, ':') != ':') {
pop_node(reader, name);
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
read_ws_star(reader);
@@ -1498,7 +1492,7 @@ read_prefixID(SerdReader* const reader, const bool sparql, const bool token)
pop_node(reader, name);
if (!sparql) {
read_ws_star(reader);
- st = eat_byte_check(reader, '.') ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX;
+ st = eat_byte_check(reader, '.') ? SERD_SUCCESS : SERD_BAD_SYNTAX;
}
return st;
@@ -1513,7 +1507,7 @@ read_directive(SerdReader* const reader)
switch (peek_byte(reader)) {
case 'B':
case 'P':
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "uppercase directive\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "uppercase directive\n");
}
}
@@ -1528,14 +1522,14 @@ read_directive(SerdReader* const reader)
break;
}
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid directive\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid directive\n");
}
static SerdStatus
read_wrappedGraph(SerdReader* const reader, ReadContext* const ctx)
{
if (!eat_byte_check(reader, '{')) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
read_ws_star(reader);
@@ -1545,7 +1539,7 @@ read_wrappedGraph(SerdReader* const reader, ReadContext* const ctx)
ctx->subject = 0;
SerdStatus st = read_subject(reader, *ctx, &ctx->subject, &s_type);
if (st) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "bad subject\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "bad subject\n");
}
if ((st = read_triples(reader, *ctx, &ate_dot)) && s_type != '[') {
@@ -1563,7 +1557,7 @@ read_wrappedGraph(SerdReader* const reader, ReadContext* const ctx)
skip_byte(reader, '}');
read_ws_star(reader);
if (peek_byte(reader) == '.') {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "graph followed by '.'\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "graph followed by '.'\n");
}
return SERD_SUCCESS;
@@ -1605,7 +1599,7 @@ read_n3_statement(SerdReader* const reader)
case '@':
if (!fancy_syntax(reader)) {
return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "syntax does not support directives\n");
+ reader, SERD_BAD_SYNTAX, "syntax does not support directives\n");
}
TRY(st, read_directive(reader));
read_ws_star(reader);
@@ -1615,8 +1609,7 @@ read_n3_statement(SerdReader* const reader)
TRY(st, read_wrappedGraph(reader, &ctx));
read_ws_star(reader);
} else {
- return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "syntax does not support graphs\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "syntax does not support graphs\n");
}
break;
default:
@@ -1637,10 +1630,10 @@ read_n3_statement(SerdReader* const reader)
read_ws_star(reader);
} else if (!tokcmp(reader, ctx.subject, "true", 4) ||
!tokcmp(reader, ctx.subject, "false", 5)) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected subject\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "expected subject\n");
} else if (read_ws_star(reader) && peek_byte(reader) == '{') {
if (s_type == '(' || (s_type == '[' && !*ctx.flags)) {
- return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid graph name\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "invalid graph name\n");
}
ctx.graph = ctx.subject;
ctx.subject = 0;
@@ -1653,15 +1646,14 @@ read_n3_statement(SerdReader* const reader)
}
if (ate_dot) {
- return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "unexpected end of statement\n");
+ return r_err(reader, SERD_BAD_SYNTAX, "unexpected end of statement\n");
}
- return st > SERD_FAILURE ? st : SERD_ERR_BAD_SYNTAX;
+ return st > SERD_FAILURE ? st : SERD_BAD_SYNTAX;
} else if (!ate_dot) {
read_ws_star(reader);
- st = (eat_byte_check(reader, '.') == '.') ? SERD_SUCCESS
- : SERD_ERR_BAD_SYNTAX;
+ st =
+ (eat_byte_check(reader, '.') == '.') ? SERD_SUCCESS : SERD_BAD_SYNTAX;
}
ctx.subject = pop_node(reader, ctx.subject);
@@ -1720,7 +1712,7 @@ read_nquads_statement(SerdReader* const reader)
if (peek_byte(reader) == '@') {
return r_err(
- reader, SERD_ERR_BAD_SYNTAX, "syntax does not support directives\n");
+ reader, SERD_BAD_SYNTAX, "syntax does not support directives\n");
}
// subject predicate object
@@ -1746,7 +1738,7 @@ read_nquads_statement(SerdReader* const reader)
// Terminating '.'
read_ws_star(reader);
if (!eat_byte_check(reader, '.')) {
- return SERD_ERR_BAD_SYNTAX;
+ return SERD_BAD_SYNTAX;
}
}