Skip to content

Commit 8e3b997

Browse files
committed
chore: refactor lexer
1 parent 73791d8 commit 8e3b997

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/N3Lexer.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,11 @@ export default class N3Lexer {
296296
// We can properly evaluate this case if we are
297297
// not in rdfStar mode or we can look ahead to
298298
// see if there is a pipe following the {
299-
if (input.length > 1 || !this._supportsRDFStar) {
300-
if (input[1] === '|') {
301-
type = '{|', matchLength = 2;
302-
}
303-
else if (!this._lineMode) {
304-
matchLength = 1, type = firstChar;
305-
}
306-
}
299+
const long = input.length !== 1;
300+
if (long && input[1] === '|')
301+
matchLength = 2, type = '{|';
302+
else if (!this._lineMode && (long || !this._supportsRDFStar))
303+
matchLength = 1, type = firstChar;
307304
break;
308305
case '!':
309306
if (!this._n3Mode)

0 commit comments

Comments
 (0)