@@ -86,7 +86,7 @@ export default class N3Parser {
8686 this . _inversePredicate = false ;
8787 // In N3, blank nodes are scoped to a formula
8888 // (using a dot as separator, as a blank node label cannot start with it)
89- this . _prefixes . _ = ( this . _graph ? this . _graph . id . substr ( 2 ) + '.' : '.' ) ;
89+ this . _prefixes . _ = ( this . _graph ? ` ${ this . _graph . id . substr ( 2 ) } .` : '.' ) ;
9090 // Quantifiers are scoped to a formula
9191 this . _quantified = Object . create ( this . _quantified ) ;
9292 }
@@ -160,7 +160,7 @@ export default class N3Parser {
160160 case 'prefixed' :
161161 const prefix = this . _prefixes [ token . prefix ] ;
162162 if ( prefix === undefined )
163- return this . _error ( ' Undefined prefix "' + token . prefix + ':"' , token ) ;
163+ return this . _error ( ` Undefined prefix "${ token . prefix } :"` , token ) ;
164164 value = this . _namedNode ( prefix + token . value ) ;
165165 break ;
166166 // Read a blank node
@@ -173,7 +173,7 @@ export default class N3Parser {
173173 break ;
174174 // Everything else is not an entity
175175 default :
176- return this . _error ( ' Expected entity but got ' + token . type , token ) ;
176+ return this . _error ( ` Expected entity but got ${ token . type } ` , token ) ;
177177 }
178178 // In N3 mode, replace the entity if it is quantified
179179 if ( ! quantifier && this . _n3Mode && ( value . id in this . _quantified ) )
@@ -265,7 +265,7 @@ export default class N3Parser {
265265 case '}' :
266266 // Expected predicate didn't come, must have been trailing semicolon
267267 if ( this . _predicate === null )
268- return this . _error ( ' Unexpected ' + type , token ) ;
268+ return this . _error ( ` Unexpected ${ type } ` , token ) ;
269269 this . _subject = null ;
270270 return type === ']' ? this . _readBlankNodeTail ( token ) : this . _readPunctuation ( token ) ;
271271 case ';' :
@@ -338,7 +338,7 @@ export default class N3Parser {
338338 // ### `_readGraph` reads a graph
339339 _readGraph ( token ) {
340340 if ( token . type !== '{' )
341- return this . _error ( ' Expected graph but got ' + token . type , token ) ;
341+ return this . _error ( ` Expected graph but got ${ token . type } ` , token ) ;
342342 // The "subject" we read is actually the GRAPH's label
343343 this . _graph = this . _subject , this . _subject = null ;
344344 return this . _readSubject ;
@@ -604,7 +604,7 @@ export default class N3Parser {
604604 next = this . _readQuadPunctuation ;
605605 break ;
606606 }
607- return this . _error ( ' Expected punctuation to follow "' + this . _object . id + '"' , token ) ;
607+ return this . _error ( ` Expected punctuation to follow "${ this . _object . id } "` , token ) ;
608608 }
609609 // A quad has been completed now, so return it
610610 if ( subject !== null ) {
@@ -630,7 +630,7 @@ export default class N3Parser {
630630 next = this . _readObject ;
631631 break ;
632632 default :
633- return this . _error ( ' Expected punctuation to follow "' + this . _object . id + '"' , token ) ;
633+ return this . _error ( ` Expected punctuation to follow "${ this . _object . id } "` , token ) ;
634634 }
635635 // A quad has been completed now, so return it
636636 this . _emit ( this . _subject , this . _predicate , this . _object , this . _graph ) ;
@@ -655,7 +655,7 @@ export default class N3Parser {
655655 // ### `_readPrefixIRI` reads the IRI of a prefix declaration
656656 _readPrefixIRI ( token ) {
657657 if ( token . type !== 'IRI' )
658- return this . _error ( ' Expected IRI to follow prefix "' + this . _prefix + ':"' , token ) ;
658+ return this . _error ( ` Expected IRI to follow prefix "${ this . _prefix } :"` , token ) ;
659659 const prefixNode = this . _readEntity ( token ) ;
660660 this . _prefixes [ this . _prefix ] = prefixNode . value ;
661661 this . _prefixCallback ( this . _prefix , prefixNode ) ;
@@ -715,7 +715,7 @@ export default class N3Parser {
715715 if ( ( entity = this . _readEntity ( token , true ) ) !== undefined )
716716 break ;
717717 default :
718- return this . _error ( ' Unexpected ' + token . type , token ) ;
718+ return this . _error ( ` Unexpected ${ token . type } ` , token ) ;
719719 }
720720 // Without explicit quantifiers, map entities to a quantified entity
721721 if ( ! this . _explicitQuantifiers )
@@ -825,7 +825,7 @@ export default class N3Parser {
825825 // An entity means this is a quad (only allowed if not already inside a graph)
826826 if ( this . _supportsQuads && this . _graph === null && ( this . _graph = this . _readEntity ( token ) ) !== undefined )
827827 return this . _readRDFStarTail ;
828- return this . _error ( ' Expected >> to follow "' + this . _object . id + '"' , token ) ;
828+ return this . _error ( ` Expected >> to follow "${ this . _object . id } "` , token ) ;
829829 }
830830 return this . _readRDFStarTail ( token ) ;
831831 }
@@ -875,7 +875,7 @@ export default class N3Parser {
875875
876876 // ### `_error` emits an error message through the callback
877877 _error ( message , token ) {
878- const err = new Error ( message + ' on line ' + token . line + '.' ) ;
878+ const err = new Error ( ` ${ message } on line ${ token . line } .` ) ;
879879 err . context = {
880880 token : token ,
881881 line : token . line ,
@@ -965,7 +965,7 @@ export default class N3Parser {
965965 result = result . substr ( 0 , segmentStart ) ;
966966 // Remove a trailing '/..' segment
967967 if ( next !== '/' )
968- return result + '/' + iri . substr ( i + 1 ) ;
968+ return ` ${ result } / ${ iri . substr ( i + 1 ) } ` ;
969969 segmentStart = i + 1 ;
970970 }
971971 }
@@ -986,7 +986,7 @@ export default class N3Parser {
986986 this . _sparqlStyle = false ;
987987 this . _prefixes = Object . create ( null ) ;
988988 this . _prefixes . _ = this . _blankNodePrefix ? this . _blankNodePrefix . substr ( 2 )
989- : 'b' + blankNodePrefix ++ + '_' ;
989+ : `b ${ blankNodePrefix ++ } _` ;
990990 this . _prefixCallback = prefixCallback || noop ;
991991 this . _inversePredicate = false ;
992992 this . _quantified = Object . create ( null ) ;
0 commit comments