diff options
-rw-r--r-- | src/reader.c | 2 | ||||
-rw-r--r-- | tests/test-num.out | 6 | ||||
-rw-r--r-- | tests/test-num.ttl | 9 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/reader.c b/src/reader.c index 3a4ef452..6d7badbf 100644 --- a/src/reader.c +++ b/src/reader.c @@ -908,7 +908,7 @@ read_literal(SerdReader reader, Node* dest) Ref str = 0; Node datatype = INTERNAL_NODE_NULL; const uint8_t c = peek_byte(reader); - if (c == '-' || c == '+' || is_digit(c)) { + if (c == '-' || c == '+' || c == '.' || is_digit(c)) { return read_number(reader, dest); } else if (c == '\"') { str = read_quotedString(reader); diff --git a/tests/test-num.out b/tests/test-num.out new file mode 100644 index 00000000..447f11df --- /dev/null +++ b/tests/test-num.out @@ -0,0 +1,6 @@ +<http://example.org/eg#thing> <http://example.org/eg#num> "0.1"^^<http://www.w3.org/2001/XMLSchema#decimal> . +<http://example.org/eg#thing> <http://example.org/eg#num> "+0.2"^^<http://www.w3.org/2001/XMLSchema#decimal> . +<http://example.org/eg#thing> <http://example.org/eg#num> "-0.3"^^<http://www.w3.org/2001/XMLSchema#decimal> . +<http://example.org/eg#thing> <http://example.org/eg#num> ".4"^^<http://www.w3.org/2001/XMLSchema#decimal> . +<http://example.org/eg#thing> <http://example.org/eg#num> "+.5"^^<http://www.w3.org/2001/XMLSchema#decimal> . +<http://example.org/eg#thing> <http://example.org/eg#num> "-.6"^^<http://www.w3.org/2001/XMLSchema#decimal> . diff --git a/tests/test-num.ttl b/tests/test-num.ttl new file mode 100644 index 00000000..086ca5ab --- /dev/null +++ b/tests/test-num.ttl @@ -0,0 +1,9 @@ +@prefix eg: <http://example.org/eg#> . + +eg:thing eg:num 0.1 . +eg:thing eg:num +0.2 . +eg:thing eg:num -0.3 . +eg:thing eg:num .4 . +eg:thing eg:num +.5 . +eg:thing eg:num -.6 . + |