Skip to content

Commit 4bf01d1

Browse files
committed
Fix rejection of triple quotes in line mode.
1 parent d45e1ff commit 4bf01d1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/N3Lexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function N3Lexer(options) {
2626
// In line mode (N-Triples or N-Quads), only simple features may be parsed
2727
if (options.lineMode) {
2828
// Don't tokenize special literals
29-
this._tripleQuotedString = this._number = this._boolean = /$0^/;
29+
this._tripleApos = this._tripleQuote = this._number = this._boolean = /$0^/;
3030
// Swap the tokenize method for a restricted version
3131
var self = this;
3232
this._tokenize = this.tokenize;

test/N3Parser-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,14 @@ describe('N3Parser', function () {
10891089
it('should not parse a prefix declaration',
10901090
shouldNotParse(parser, '@prefix : <p#>.', 'Unexpected "@prefix" on line 1.'));
10911091

1092+
it('should not parse triple-quoted literals',
1093+
shouldNotParse(parser, '_:a <http://ex.org/b> """c""".',
1094+
'Unexpected """"c"""." on line 1.'));
1095+
1096+
it('should not parse triple-apostrophe literals',
1097+
shouldNotParse(parser, "_:a <http://ex.org/b> '''c'''.",
1098+
"Unexpected \"'''c'''.\" on line 1."));
1099+
10921100
it('should not parse a variable',
10931101
shouldNotParse(parser, '?a ?b ?c.', 'Unexpected "?a" on line 1.'));
10941102

0 commit comments

Comments
 (0)