eyeprolog 1.1.21 → 1.1.22
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.
- package/conformance-report.md +2 -2
- package/package.json +1 -1
- package/src/parser.js +13 -0
- package/test/conformance/README.md +1 -1
- package/test/conformance/cases/iso/operator_atoms_as_arguments.pl +7 -0
- package/test/conformance/expected/iso/operator_atoms_as_arguments.pl +2 -0
- package/test/run-regression.mjs +10 -0
- package/the-art-of-eyeprolog.md +6 -2
package/conformance-report.md
CHANGED
|
@@ -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 |
|
|
14
|
+
| iso | 166 | 209 | 0 | 0 | 375 |
|
|
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** | **
|
|
26
|
+
| **Total** | **481** | **260** | **19** | **21** | **781** |
|
package/package.json
CHANGED
package/src/parser.js
CHANGED
|
@@ -225,6 +225,11 @@ class Parser {
|
|
|
225
225
|
}
|
|
226
226
|
operatorTokenName(token = this.token) {
|
|
227
227
|
if (token.type === TOK.ATOM) return token.text;
|
|
228
|
+
// `:-` has its own token because it also introduces clauses/directives,
|
|
229
|
+
// but ISO 6.3.3.1 still permits an operator atom as an argument. Treat the
|
|
230
|
+
// token as the ordinary operator name while parsing terms; the surrounding
|
|
231
|
+
// grammar decides whether it is operator notation or atom data.
|
|
232
|
+
if (token.type === TOK.IF) return ':-';
|
|
228
233
|
if (token.type === TOK.STRING && this.parserFlagState.doubleQuotes === 'atom') return token.text;
|
|
229
234
|
return null;
|
|
230
235
|
}
|
|
@@ -533,6 +538,14 @@ class Parser {
|
|
|
533
538
|
return left;
|
|
534
539
|
}
|
|
535
540
|
parsePrefixTerm(minPrecedence = 0, allowBar = true) {
|
|
541
|
+
// `:-` is tokenized specially so the program grammar can recognize clause
|
|
542
|
+
// and directive markers. In term argument position, however, ISO 6.3.3.1
|
|
543
|
+
// permits an operator atom directly as an `arg`; a leading `:-` cannot be
|
|
544
|
+
// prefix operator notation at argument priority, so it denotes the atom.
|
|
545
|
+
if (this.token.type === TOK.IF) {
|
|
546
|
+
this.advance();
|
|
547
|
+
return atom(':-');
|
|
548
|
+
}
|
|
536
549
|
const operatorName = this.operatorTokenName();
|
|
537
550
|
if (operatorName != null && this.prefixOperators.get(operatorName)?.precedence >= minPrecedence) {
|
|
538
551
|
const op = operatorName;
|
|
@@ -94,7 +94,7 @@ Selected cases are adapted from the ISO and standard-core suites of Logtalk,
|
|
|
94
94
|
Scryer Prolog, Trealla Prolog, and SWI-Prolog. Their upstream identifiers and licenses
|
|
95
95
|
are recorded in [THIRD_PARTY.md](THIRD_PARTY.md).
|
|
96
96
|
|
|
97
|
-
The corpus has
|
|
97
|
+
The corpus has 375 cases in `iso/` and 781 file-based conformance cases in
|
|
98
98
|
total. The generated `conformance-report.md` is the authoritative source for
|
|
99
99
|
current category totals. Together with regression, documentation-sync, API,
|
|
100
100
|
example, and book-example checks, `npm test` is the release gate.
|
package/test/run-regression.mjs
CHANGED
|
@@ -940,6 +940,16 @@ c4 ?- call((!;1)).
|
|
|
940
940
|
assertEqual(program.findGroup('b', 0).clauses.length, 1, 'b/0 count');
|
|
941
941
|
},
|
|
942
942
|
},
|
|
943
|
+
{
|
|
944
|
+
name: 'ISO operator atoms are valid functional and list arguments',
|
|
945
|
+
run: () => {
|
|
946
|
+
const source = [
|
|
947
|
+
'operator_argument(ok) :- current_op(1200, xfx, :-), [:-,-] = [:-,-].',
|
|
948
|
+
'',
|
|
949
|
+
].join('\n');
|
|
950
|
+
assertEqual(run(source, { goal: 'operator_argument(ok)' }).stdout, 'operator_argument(ok).\n', 'operator argument syntax');
|
|
951
|
+
},
|
|
952
|
+
},
|
|
943
953
|
{
|
|
944
954
|
name: 'term input keeps dotted operators intact and uses program operators',
|
|
945
955
|
run: () => {
|
package/the-art-of-eyeprolog.md
CHANGED
|
@@ -5120,7 +5120,11 @@ The fact is exactly `reports(sensor_7, temperature)`. Priority determines
|
|
|
5120
5120
|
binding strength, and `fx`, `fy`, `xf`, `yf`, `xfx`, `xfy`, and `yfx`
|
|
5121
5121
|
determine position and associativity. `current_op/3` inspects the table;
|
|
5122
5122
|
`op(0, Specifier, Name)` removes a definition. Because declarations affect
|
|
5123
|
-
parsing of subsequent text, place them before their first use.
|
|
5123
|
+
parsing of subsequent text, place them before their first use. ISO argument
|
|
5124
|
+
syntax also permits an atom that is currently an operator to appear directly
|
|
5125
|
+
as a functional argument or list element, so forms such as
|
|
5126
|
+
`current_op(Priority, Specifier, :-)` and `[:-,-]` are valid without quoting
|
|
5127
|
+
or parenthesizing those operator atoms.
|
|
5124
5128
|
|
|
5125
5129
|
Run [`iso-dynamic-database.pl`](https://github.com/eyereasoner/eyeprolog/blob/main/examples/iso-dynamic-database.pl)
|
|
5126
5130
|
for an explicitly stateful queue and
|
|
@@ -6845,7 +6849,7 @@ node test/run-conformance-report.mjs
|
|
|
6845
6849
|
```
|
|
6846
6850
|
|
|
6847
6851
|
The complete suite must pass before release. The file-based conformance corpus
|
|
6848
|
-
contains
|
|
6852
|
+
contains 781 cases, including 375 focused ISO
|
|
6849
6853
|
cases derived from the success, failure, mode, and error behavior in
|
|
6850
6854
|
ISO/IEC 13211-1 clauses 7 and 8, Part 2 modules, and Part 3 grammar rules.
|
|
6851
6855
|
Separate exact-output suites check 189 normal
|