Comparing version 0.1.1 to 0.1.2
@@ -9,9 +9,9 @@ // **N3Lexer** tokenizes N3 documents. | ||
_prefix: /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=\s)/, | ||
_qname: /^((?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=[\s\.;,)])/, | ||
_number: /^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d+\.\d+|\.\d+|\d+)(?=\s*[\s\.;,)])/, | ||
_boolean: /^(?:true|false)(?=\s+)/, | ||
_qname: /^((?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=[\s\.;,)#])/, | ||
_number: /^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d+\.\d+|\.\d+|\d+)(?=\s*[\s\.;,)#])/, | ||
_boolean: /^(?:true|false)(?=[\s#])/, | ||
_punctuation: /^\.(?!\d)|^;|^,|^\[|^\]|^\(|^\)/, // If a digit follows a dot, it is a number, not punctuation. | ||
_fastString: /^"[^"\\]+"(?=[^"\\])/, | ||
_keyword: /^(?:@[a-z]+|[Pp][Rr][Ee][Ff][Ii][Xx]|[Bb][Aa][Ss][Ee])(?=\s)/, | ||
_type: /^\^\^(?:<([^>]*)>|([A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd][\-0-9A-Z_a-z\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*)?:([A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd][\-0-9A-Z_a-z\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*)(?=[\s\.;,)]))/, | ||
_type: /^\^\^(?:<([^>]*)>|([A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd][\-0-9A-Z_a-z\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*)?:([A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd][\-0-9A-Z_a-z\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*)(?=[\s\.;,)#]))/, | ||
_shortPredicates: /^a(?=\s+|<)/, | ||
@@ -18,0 +18,0 @@ _newline: /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/, |
@@ -192,3 +192,3 @@ // **N3Parser** parses N3 documents. | ||
} | ||
return this._getNextReader(); | ||
return this._getTripleEndReader(); | ||
}, | ||
@@ -224,3 +224,3 @@ | ||
this._object = triple.object; | ||
return this._getNextReader(); | ||
return this._getTripleEndReader(); | ||
} | ||
@@ -246,8 +246,8 @@ // The blank node was the subject, so continue reading the predicate. | ||
this._object += '^^<' + value + '>'; | ||
return this._readPunctuation; | ||
return this._getTripleEndReader(); | ||
case 'langcode': | ||
this._object += '@' + token.value.toLowerCase(); | ||
return this._getNextReader(); | ||
return this._getTripleEndReader(); | ||
default: | ||
return this._getNextReader().call(this, token); | ||
return this._getTripleEndReader().call(this, token); | ||
} | ||
@@ -325,3 +325,3 @@ }, | ||
this._object = parentTriple.object; | ||
next = this._getNextReader(); | ||
next = this._getTripleEndReader(); | ||
// Skip writing the list tail if this was an empty list. | ||
@@ -438,4 +438,4 @@ if (parentTriple.object === RDF_NIL) | ||
// ### `_getNextReader` gets the next reader function at the end of a triple. | ||
_getNextReader: function () { | ||
// ### `_getTripleEndReader` gets the next reader function at the end of a triple. | ||
_getTripleEndReader: function () { | ||
var stack = this._tripleStack; | ||
@@ -442,0 +442,0 @@ if (stack.length === 0) |
{ | ||
"name": "n3", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.", | ||
@@ -5,0 +5,0 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", |
@@ -14,3 +14,3 @@ #!/usr/bin/env node | ||
// Path to the tests and the tests' manifest | ||
var testPath = "https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/tests-ttl/", | ||
var testPath = "http://www.w3.org/2013/TurtleTests/", | ||
manifest = "manifest.ttl"; | ||
@@ -23,3 +23,2 @@ | ||
rdft: "http://www.w3.org/ns/rdftest#", | ||
base: "http://example/base/", | ||
dc: "http://purl.org/dc/terms/", | ||
@@ -143,3 +142,3 @@ doap: "http://usefulinc.com/ns/doap#", | ||
request.get(testPath + testFile, | ||
function (error, response, body) { callback(error, body); }) | ||
function (error, response, body) { callback(error, body || ""); }) | ||
.pipe(fs.createWriteStream(localFile)); | ||
@@ -166,3 +165,3 @@ }); | ||
// Try to parse the specified document | ||
var config = { documentURI: prefixes.base + test.action }; | ||
var config = { documentURI: testPath + test.action }; | ||
new N3Parser(config).parse(actionTurtle, | ||
@@ -169,0 +168,0 @@ function (error, triple) { |
@@ -166,2 +166,20 @@ var N3Parser = require('../lib/n3parser.js'); | ||
'should parse a multi-statement blank node ending with a literal': | ||
shouldParse('<a> <b> [ <u> <v>; <w> "z" ].', | ||
['a', 'b', '_:b0'], | ||
['_:b0', 'u', 'v'], | ||
['_:b0', 'w', '"z"']), | ||
'should parse a multi-statement blank node ending with a typed literal': | ||
shouldParse('<a> <b> [ <u> <v>; <w> "z"^^<t> ].', | ||
['a', 'b', '_:b0'], | ||
['_:b0', 'u', 'v'], | ||
['_:b0', 'w', '"z"^^<t>']), | ||
'should parse a multi-statement blank node ending with a string with language': | ||
shouldParse('<a> <b> [ <u> <v>; <w> "z"^^<t> ].', | ||
['a', 'b', '_:b0'], | ||
['_:b0', 'u', 'v'], | ||
['_:b0', 'w', '"z"^^<t>']), | ||
'should parse a multi-statement blank node with trailing semicolon': | ||
@@ -168,0 +186,0 @@ shouldParse('<a> <b> [ <u> <v>; <w> <z>; ].', |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103482
2197