eyeprolog 1.2.10 → 1.2.11

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.
@@ -11,7 +11,7 @@ This report summarizes the file-based conformance corpus under `test/conformance
11
11
  | builtins | 11 | 0 | 0 | 0 | 11 |
12
12
  | context | 11 | 0 | 0 | 0 | 11 |
13
13
  | control | 15 | 0 | 0 | 0 | 15 |
14
- | iso | 167 | 216 | 0 | 0 | 383 |
14
+ | iso | 167 | 218 | 0 | 0 | 385 |
15
15
  | lists | 52 | 3 | 0 | 0 | 55 |
16
16
  | modules | 2 | 0 | 0 | 0 | 2 |
17
17
  | negation | 8 | 0 | 19 | 0 | 27 |
@@ -23,4 +23,4 @@ This report summarizes the file-based conformance corpus under `test/conformance
23
23
  | terms | 26 | 3 | 0 | 0 | 29 |
24
24
  | unification | 18 | 0 | 0 | 0 | 18 |
25
25
  | variables | 16 | 9 | 0 | 0 | 25 |
26
- | **Total** | **482** | **267** | **19** | **21** | **789** |
26
+ | **Total** | **482** | **269** | **19** | **21** | **791** |
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.2.10",
6
+ "version": "1.2.11",
7
7
  "description": "EyeProlog turns facts and rules into answers and proofs.",
8
8
  "type": "module",
9
9
  "main": "./index.js",
package/src/iso.js CHANGED
@@ -1564,6 +1564,13 @@ function parseIsoNumber(text) {
1564
1564
  }
1565
1565
 
1566
1566
  const numericText = `${sign}${text.slice(position)}`;
1567
+ // 8.16.7/8.16.8 parse the character sequence according to the syntax rules
1568
+ // for numbers and negative numbers (6.3.1.1/6.3.1.2), not as an arbitrary
1569
+ // term whose value happens to be numeric. Every such number starts with a
1570
+ // decimal digit after an optional negative sign, so parenthesized terms such
1571
+ // as `(0)` or `-(0)` must be rejected before the general term parser sees
1572
+ // them. This keeps the parser reuse below from admitting grouping syntax.
1573
+ if (!/^-?\d/.test(numericText)) return null;
1567
1574
  // ISO floating-point syntax requires a decimal fraction before an exponent.
1568
1575
  if (/^-?\d+[eE][+-]?\d+$/.test(numericText)) return null;
1569
1576
  try {
@@ -16,7 +16,7 @@ compliance audit and the remaining work before a full conformance claim.
16
16
  | 8.8-8.10 database and solutions | logical update view, dynamic mutation, all-solutions grouping | `dynamic_database`, `trealla_logical_update_view`, `corrigenda_retractall`, `grouped_solutions_and_clauses` |
17
17
  | 8.11-8.14 streams and term I/O | text/binary streams, properties, units, read/write options and operators | `streams_and_term_io`, `operators`, Corrigendum 3 option cases, stream error cases |
18
18
  | 8.15 logic and control | negation, once, repeat, `call/2` through `call/8`, `false/0` | `logtalk_once`, `corrigenda_call_closure`, `false_builtin` |
19
- | 8.16 atomic processing | atoms, characters, codes and number conversion with prescribed errors | `atomic_term_processing`, focused forward/reverse cases, Logtalk-derived error cases |
19
+ | 8.16 atomic processing | atoms, characters, codes and number conversion with prescribed errors | `atomic_term_processing`, focused forward/reverse cases, parenthesized-number rejection, Logtalk-derived error cases |
20
20
  | 8.17 flags and hooks | required flags, mutation permissions, halt and character conversion | `exceptions_and_flags`, `remaining_builtins_and_directives`, flag error cases |
21
21
  | Clause 9 evaluable functors | integer, float, rounding, transcendental and bitwise operations | `arithmetic`, `corrigenda_arithmetic`, `corrigenda_atan2_zero`, `corrigenda_integer_negative_power` |
22
22
  | ISO/IEC 13211-2 modules | module declarations, exports, imports, qualification, meta-predicate context | `modules/qualified_call`, `modules/selective_library_import`, `dcg_module_nonterminal_indicator` |
@@ -102,7 +102,7 @@ Selected cases are adapted from the ISO and standard-core suites of Logtalk,
102
102
  Scryer Prolog, Trealla Prolog, and SWI-Prolog. Their upstream identifiers and licenses
103
103
  are recorded in [THIRD_PARTY.md](THIRD_PARTY.md).
104
104
 
105
- The corpus has 383 cases in `iso/` and 789 file-based conformance cases in
105
+ The corpus has 385 cases in `iso/` and 791 file-based conformance cases in
106
106
  total. The generated `conformance-report.md` is the authoritative source for
107
107
  current category totals. Together with regression, documentation-sync, API,
108
108
  example, and book-example checks, `npm test` is the release gate.
@@ -0,0 +1,2 @@
1
+ %% goal: number_chars(_, ['(', '0', ')'])
2
+ answer :- number_chars(_, ['(', '0', ')']).
@@ -0,0 +1,2 @@
1
+ %% goal: number_codes(_, [40, 48, 41])
2
+ answer :- number_codes(_, [40, 48, 41]).
@@ -0,0 +1 @@
1
+ error(syntax_error(number))
@@ -0,0 +1 @@
1
+ error(syntax_error(number))
@@ -36,6 +36,9 @@
36
36
  70 ?- number_chars(N,"0x11").
37
37
  N=17.
38
38
 
39
+ 73 ?- number_chars(N,"(0)").
40
+ syntax_error(...).
41
+
39
42
  4 ?- number_chars(1,"a").
40
43
  syntax_error(...).
41
44
 
@@ -396,9 +396,24 @@ c4 ?- call((!;1)).
396
396
  text: source,
397
397
  filename,
398
398
  }]));
399
- assertEqual(result.total, 72, 'quad total');
400
- assertEqual(result.passed, 72, 'quad passed');
401
- assertEqual(result.stdout, 'quads: 72 run, 72 passed, 0 failed.\n', 'quad report');
399
+ assertEqual(result.total, 73, 'quad total');
400
+ assertEqual(result.passed, 73, 'quad passed');
401
+ assertEqual(result.stdout, 'quads: 73 run, 73 passed, 0 failed.\n', 'quad report');
402
+ },
403
+ },
404
+ {
405
+ name: 'number conversion rejects parenthesized numeric terms',
406
+ run: () => {
407
+ for (const goal of ['number_chars(N,"(0)")', 'number_codes(N,[40,48,41])']) {
408
+ let caught = null;
409
+ try {
410
+ publicApi.run('', { goal });
411
+ } catch (error) {
412
+ caught = error;
413
+ }
414
+ if (caught == null) throw new Error(`${goal} should throw`);
415
+ assertIncludes(String(caught?.message ?? caught), 'syntax_error(number)', goal);
416
+ }
402
417
  },
403
418
  },
404
419
  {
@@ -5735,13 +5735,16 @@ quoted_atom("ab"). % quoted_atom(ab)
5735
5735
  | `sub_atom(+Atom,?Before,?Length,?After,?SubAtom)` | Enumerates substrings and their Unicode-code-point offsets. Supplied counts must be nonnegative integers. |
5736
5736
  | `atom_chars(?Atom,?Chars)`, `atom_codes(?Atom,?Codes)` | Convert between an atom and a proper list of one-character atoms or Unicode scalar codes. At least one side must be instantiated. |
5737
5737
  | `char_code(?Character,?Code)` | Converts one character atom and one Unicode scalar code. Surrogates and values outside `0..0x10ffff` raise a representation error. |
5738
- | `number_chars(?Number,?Chars)`, `number_codes(?Number,?Codes)` | Convert finite numbers to canonical text or parse a proper character/code list using ISO numeric-token syntax, including radix integers, character-code constants, and leading layout. At least one side must be instantiated; malformed numeric input raises *syntax_error(number)*. |
5738
+ | `number_chars(?Number,?Chars)`, `number_codes(?Number,?Codes)` | Convert finite numbers to canonical text or parse a proper character/code list using ISO number and negative-number syntax, including radix integers, character-code constants, and leading layout. The input is not parsed as a general term: grouping such as `(0)` is a syntax error. At least one side must be instantiated; malformed numeric input raises *syntax_error(number)*. |
5739
5739
 
5740
5740
  Conversions accept partial output lists when the atomic input is known, but
5741
5741
  constructing an atom or number requires a complete proper list with no unbound
5742
5742
  elements. Numeric parsing accepts leading ISO layout characters, an optional
5743
5743
  sign, decimal fractions, and decimal exponents; it rejects trailing material
5744
- and non-finite values.
5744
+ and non-finite values. The regression gate vendors all 73 numbered cases from
5745
+ Ulrich Neumerkel's contemporary `number_chars/2` comparison, including the
5746
+ Cor.2 error-precedence cases; `number_codes/2` shares the same numeric parser
5747
+ and has mirrored coverage for the parenthesized-number regression.
5745
5748
 
5746
5749
  ### Streams and unit I/O
5747
5750
 
@@ -6986,7 +6989,7 @@ precedence still need one-by-one closure. `test/conformance/ISO-MATRIX.md`
6986
6989
  maps language families to representative executable cases.
6987
6990
 
6988
6991
  The complete suite must pass before release. The file-based conformance corpus
6989
- contains 789 cases, including 383 focused ISO
6992
+ contains 791 cases, including 385 focused ISO
6990
6993
  cases derived from the success, failure, mode, and error behavior in
6991
6994
  ISO/IEC 13211-1 clauses 7 and 8, Part 2 modules, and Part 3 grammar rules.
6992
6995
  Separate exact-output suites check 189 normal