eyeling 1.29.1 → 1.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13886,12 +13886,21 @@ function lex(inputText, opts = {}) {
13886
13886
  numChars.push(chars[i]);
13887
13887
  i++;
13888
13888
  }
13889
- if (i < n && chars[i] === '.' && i + 1 < n && isAsciiDigit(chars[i + 1])) {
13890
- numChars.push('.');
13891
- i++;
13892
- while (i < n && isAsciiDigit(chars[i])) {
13893
- numChars.push(chars[i]);
13889
+ if (i < n && chars[i] === '.') {
13890
+ const next = i + 1 < n ? chars[i + 1] : null;
13891
+ let exponentAfterDot = false;
13892
+ if (next === 'e' || next === 'E') {
13893
+ let j = i + 2;
13894
+ if (j < n && (chars[j] === '+' || chars[j] === '-')) j++;
13895
+ exponentAfterDot = j < n && isAsciiDigit(chars[j]);
13896
+ }
13897
+ if (isAsciiDigit(next) || exponentAfterDot) {
13898
+ numChars.push('.');
13894
13899
  i++;
13900
+ while (i < n && isAsciiDigit(chars[i])) {
13901
+ numChars.push(chars[i]);
13902
+ i++;
13903
+ }
13895
13904
  }
13896
13905
  }
13897
13906
  }
@@ -15211,7 +15220,7 @@ class Parser {
15211
15220
  }
15212
15221
 
15213
15222
  if (this.peek().typ === 'Semicolon') {
15214
- this.next();
15223
+ while (this.peek().typ === 'Semicolon') this.next();
15215
15224
  if (this.peek().typ === closingTyp) break;
15216
15225
  continue;
15217
15226
  }
@@ -15338,7 +15347,7 @@ class Parser {
15338
15347
  }
15339
15348
 
15340
15349
  if (this.peek().typ === 'Semicolon') {
15341
- this.next();
15350
+ while (this.peek().typ === 'Semicolon') this.next();
15342
15351
  if (this.peek().typ === 'Dot') break;
15343
15352
  continue;
15344
15353
  }
package/eyeling.js CHANGED
@@ -13886,12 +13886,21 @@ function lex(inputText, opts = {}) {
13886
13886
  numChars.push(chars[i]);
13887
13887
  i++;
13888
13888
  }
13889
- if (i < n && chars[i] === '.' && i + 1 < n && isAsciiDigit(chars[i + 1])) {
13890
- numChars.push('.');
13891
- i++;
13892
- while (i < n && isAsciiDigit(chars[i])) {
13893
- numChars.push(chars[i]);
13889
+ if (i < n && chars[i] === '.') {
13890
+ const next = i + 1 < n ? chars[i + 1] : null;
13891
+ let exponentAfterDot = false;
13892
+ if (next === 'e' || next === 'E') {
13893
+ let j = i + 2;
13894
+ if (j < n && (chars[j] === '+' || chars[j] === '-')) j++;
13895
+ exponentAfterDot = j < n && isAsciiDigit(chars[j]);
13896
+ }
13897
+ if (isAsciiDigit(next) || exponentAfterDot) {
13898
+ numChars.push('.');
13894
13899
  i++;
13900
+ while (i < n && isAsciiDigit(chars[i])) {
13901
+ numChars.push(chars[i]);
13902
+ i++;
13903
+ }
13895
13904
  }
13896
13905
  }
13897
13906
  }
@@ -15211,7 +15220,7 @@ class Parser {
15211
15220
  }
15212
15221
 
15213
15222
  if (this.peek().typ === 'Semicolon') {
15214
- this.next();
15223
+ while (this.peek().typ === 'Semicolon') this.next();
15215
15224
  if (this.peek().typ === closingTyp) break;
15216
15225
  continue;
15217
15226
  }
@@ -15338,7 +15347,7 @@ class Parser {
15338
15347
  }
15339
15348
 
15340
15349
  if (this.peek().typ === 'Semicolon') {
15341
- this.next();
15350
+ while (this.peek().typ === 'Semicolon') this.next();
15342
15351
  if (this.peek().typ === 'Dot') break;
15343
15352
  continue;
15344
15353
  }
package/lib/lexer.js CHANGED
@@ -1576,12 +1576,21 @@ function lex(inputText, opts = {}) {
1576
1576
  numChars.push(chars[i]);
1577
1577
  i++;
1578
1578
  }
1579
- if (i < n && chars[i] === '.' && i + 1 < n && isAsciiDigit(chars[i + 1])) {
1580
- numChars.push('.');
1581
- i++;
1582
- while (i < n && isAsciiDigit(chars[i])) {
1583
- numChars.push(chars[i]);
1579
+ if (i < n && chars[i] === '.') {
1580
+ const next = i + 1 < n ? chars[i + 1] : null;
1581
+ let exponentAfterDot = false;
1582
+ if (next === 'e' || next === 'E') {
1583
+ let j = i + 2;
1584
+ if (j < n && (chars[j] === '+' || chars[j] === '-')) j++;
1585
+ exponentAfterDot = j < n && isAsciiDigit(chars[j]);
1586
+ }
1587
+ if (isAsciiDigit(next) || exponentAfterDot) {
1588
+ numChars.push('.');
1584
1589
  i++;
1590
+ while (i < n && isAsciiDigit(chars[i])) {
1591
+ numChars.push(chars[i]);
1592
+ i++;
1593
+ }
1585
1594
  }
1586
1595
  }
1587
1596
  }
package/lib/parser.js CHANGED
@@ -547,7 +547,7 @@ class Parser {
547
547
  }
548
548
 
549
549
  if (this.peek().typ === 'Semicolon') {
550
- this.next();
550
+ while (this.peek().typ === 'Semicolon') this.next();
551
551
  if (this.peek().typ === closingTyp) break;
552
552
  continue;
553
553
  }
@@ -674,7 +674,7 @@ class Parser {
674
674
  }
675
675
 
676
676
  if (this.peek().typ === 'Semicolon') {
677
- this.next();
677
+ while (this.peek().typ === 'Semicolon') this.next();
678
678
  if (this.peek().typ === 'Dot') break;
679
679
  continue;
680
680
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.29.1",
3
+ "version": "1.29.2",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [
package/test/api.test.js CHANGED
@@ -895,6 +895,75 @@ bad.:example a bad.:Person.
895
895
  expect: [/:result\s+:has\s+:success-literal-33\s*\./, /:test\s+:is\s+true\s*\./],
896
896
  },
897
897
 
898
+ {
899
+ name: '12k6 success literal: decimal doubles with omitted fractional digits parse',
900
+ opt: { proofComments: false },
901
+ input: `
902
+ @prefix : <http://example.org/> .
903
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
904
+
905
+ :my :value1 4.e2.
906
+ :my :value2 3.e-2.
907
+ :my :value3 2.e+2.
908
+ :my :value4 1.e001.
909
+
910
+ {
911
+ :my :value1 4.e2.
912
+ :my :value2 3.e-2.
913
+ :my :value3 2.e+2.
914
+ :my :value4 1.e001.
915
+ }
916
+ =>
917
+ {
918
+ :result :has :success-literal-34.
919
+ }.
920
+
921
+ {} => {
922
+ :test :contains :success-literal-34.
923
+ }.
924
+
925
+ {
926
+ :result :has :success-literal-34.
927
+ }
928
+ =>
929
+ {
930
+ :test :is true.
931
+ }.
932
+ `,
933
+ expect: [/:result\s+:has\s+:success-literal-34\s*\./, /:test\s+:is\s+true\s*\./],
934
+ },
935
+ {
936
+ name: '12k7 success literal: repeated semicolon separators parse',
937
+ opt: { proofComments: false },
938
+ input: `
939
+ @prefix : <http://example.org/> .
940
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
941
+
942
+ :s :p :o ;;;;;;; .
943
+
944
+ {
945
+ :s :p :o .
946
+ }
947
+ =>
948
+ {
949
+ :result :has :success-literal-35.
950
+ }.
951
+
952
+ {} => {
953
+ :test :contains :success-literal-35.
954
+ }.
955
+
956
+ {
957
+ :result :has :success-literal-35.
958
+ }
959
+ =>
960
+ {
961
+ :test :is true.
962
+ }.
963
+ `,
964
+ expect: [/:result\s+:has\s+:success-literal-35\s*\./, /:test\s+:is\s+true\s*\./],
965
+ },
966
+
898
967
  {
899
968
  name: '12l regression: IRIREF \\u escape decodes before log:uri comparison (mismatch stays falsey)',
900
969
  opt: { proofComments: false },