eyelang 0.5.1 → 0.5.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.
- package/README.md +7 -7
- package/book-assets/cli-observation-loop.svg +1 -1
- package/book-assets/example-landscape.svg +1 -1
- package/book-assets/laboratory-progression.svg +1 -1
- package/book-assets/part-4-craft.svg +1 -1
- package/book-assets/rdf-adapter-pipeline.svg +3 -3
- package/book-assets/reference-navigation.svg +1 -1
- package/book-assets/review-lenses.svg +1 -1
- package/book-assets/title-page.svg +2 -2
- package/conformance-report.md +1 -1
- package/examples/book/README.md +4 -4
- package/examples/book/chapter-01/01-parent.pl +1 -1
- package/examples/book/chapter-01/02-child.pl +1 -1
- package/examples/book/chapter-02/01-measurement.pl +1 -1
- package/examples/book/chapter-02/02-label.pl +1 -1
- package/examples/book/chapter-03/01-eligible.pl +1 -1
- package/examples/book/chapter-03/02-adult.pl +1 -1
- package/examples/book/chapter-03/03-can_enter.pl +1 -1
- package/examples/book/chapter-03/04-high_score.pl +1 -1
- package/examples/book/chapter-03/05-parent.pl +1 -1
- package/examples/book/chapter-03/06-ancestor.pl +1 -1
- package/examples/book/chapter-03/07-different.pl +1 -1
- package/examples/book/chapter-03/08-has_parent.pl +1 -1
- package/examples/book/chapter-03/09-program.pl +1 -1
- package/examples/book/chapter-03/10-closed.pl +1 -1
- package/examples/book/chapter-03/11-p.pl +1 -1
- package/examples/book/chapter-04/01-path.pl +1 -1
- package/examples/book/chapter-05/01-first.pl +1 -1
- package/examples/book/chapter-05/02-reverse_acc.pl +1 -1
- package/examples/book/chapter-06/01-next.pl +1 -1
- package/examples/book/chapter-06/02-safe_reading.pl +1 -1
- package/examples/book/chapter-06/03-square.pl +1 -1
- package/examples/book/chapter-06/04-factorial.pl +1 -1
- package/examples/book/chapter-07/01-allowed.pl +1 -1
- package/examples/book/chapter-07/02-all_tests_pass.pl +1 -1
- package/examples/book/chapter-08/01-findall.pl +1 -1
- package/examples/book/chapter-08/02-outgoing_costs.pl +1 -1
- package/examples/book/chapter-08/03-best_route.pl +1 -1
- package/examples/book/chapter-09/01-functor.pl +1 -1
- package/examples/book/chapter-09/02-normalized.pl +1 -1
- package/examples/book/chapter-09/03-message.pl +1 -1
- package/examples/book/chapter-10/01-plan.pl +1 -1
- package/examples/book/chapter-11/01-why.pl +1 -1
- package/examples/book/chapter-12/01-invalid_probability.pl +1 -1
- package/examples/book/chapter-12/02-invalid_assignment.pl +1 -1
- package/examples/book/chapter-14/01-heating.pl +1 -1
- package/examples/book/chapter-15/01-rdf.pl +1 -1
- package/examples/book/chapter-16/01-socket.pl +1 -1
- package/examples/book/chapter-16/02-socket-2.pl +1 -1
- package/examples/book/chapter-17/01-path.pl +1 -1
- package/examples/book/chapter-17/02-adult.pl +1 -1
- package/examples/book/chapter-17/03-bad_member.pl +1 -1
- package/examples/book/chapter-17/04-item.pl +1 -1
- package/examples/book/chapter-18/01-routeable.pl +1 -1
- package/examples/book/chapter-18/02-routeable-2.pl +1 -1
- package/examples/book/chapter-18/03-prefix.pl +1 -1
- package/examples/book/chapter-18/04-candidate_pair.pl +1 -1
- package/examples/book/chapter-18/05-compatible_pair.pl +1 -1
- package/examples/book/chapter-19/01-factorial.pl +1 -1
- package/examples/book/chapter-19/02-invalid_limits.pl +1 -1
- package/examples/book/chapter-20/01-connected.pl +1 -1
- package/examples/book/chapter-20/02-within_thermal_limits.pl +1 -1
- package/examples/book/chapter-20/03-search.pl +1 -1
- package/examples/book/chapter-21/01-grandparent.pl +1 -1
- package/examples/book/chapter-21/02-loop_edge.pl +1 -1
- package/examples/book/chapter-21/03-eligible.pl +1 -1
- package/examples/book/chapter-21/04-grows.pl +1 -1
- package/examples/book/chapter-22/01-tree.pl +1 -1
- package/examples/book/chapter-22/02-tree_member.pl +1 -1
- package/examples/book/chapter-22/03-mirror.pl +1 -1
- package/examples/book/chapter-22/04-evaluate.pl +1 -1
- package/examples/book/chapter-22/05-lookup.pl +1 -1
- package/examples/book/chapter-22/06-simplify.pl +1 -1
- package/examples/book/chapter-23/01-adult.pl +1 -1
- package/examples/book/chapter-23/02-adult-2.pl +1 -1
- package/examples/book/chapter-23/03-can_board.pl +1 -1
- package/examples/book/chapter-23/04-traveler_in_good_standing.pl +1 -1
- package/examples/book/chapter-23/05-connection.pl +1 -1
- package/examples/book/chapter-23/06-rail_connection.pl +1 -1
- package/examples/book/chapter-23/07-sum_numbers.pl +1 -1
- package/examples/book/chapter-23/08-sum_numbers_acc.pl +1 -1
- package/examples/book/chapter-24/01-simple_path.pl +1 -1
- package/examples/book/chapter-24/02-reachable.pl +1 -1
- package/examples/book/chapter-24/03-best_plan.pl +1 -1
- package/examples/book/chapter-25/01-person.pl +1 -1
- package/examples/book/chapter-25/02-active_badge.pl +1 -1
- package/examples/book/chapter-25/03-in_good_standing.pl +1 -1
- package/examples/book/chapter-25/04-incompatible_status.pl +1 -1
- package/examples/book/chapter-26/01-mortal.pl +1 -1
- package/examples/book/chapter-26/02-triple.pl +1 -1
- package/examples/book/chapter-26/03-edge.pl +1 -1
- package/examples/book/chapter-27/01-natural.pl +1 -1
- package/examples/book/chapter-27/02-list_length.pl +1 -1
- package/examples/book/chapter-27/03-reverse_acc.pl +1 -1
- package/examples/book/chapter-28/01-program.pl +1 -1
- package/examples/book/chapter-28/02-triangle.pl +1 -1
- package/examples/book/chapter-28/03-rectangle.pl +1 -1
- package/examples/book/chapter-28/04-preserves_combine.pl +1 -1
- package/examples/book/chapter-29/01-noncommuting_pair.pl +1 -1
- package/examples/book/chapter-32/01-eligible.pl +1 -1
- package/examples/book/chapter-32/02-eligible-2.pl +1 -1
- package/examples/book/chapter-33/01-assigned_badge.pl +1 -1
- package/examples/book/chapter-33/02-source_role.pl +1 -1
- package/examples/book/chapter-33/03-chosen_pair.pl +1 -1
- package/examples/book/chapter-33/04-path.pl +1 -1
- package/examples/book/chapter-33/05-unregistered.pl +1 -1
- package/examples/book/chapter-33/06-step.pl +1 -1
- package/examples/book/chapter-33/07-depends.pl +1 -1
- package/examples/book/chapter-33/08-within_limit.pl +1 -1
- package/examples/book/chapter-33/09-invalid_badge_assignment.pl +1 -1
- package/examples/book/chapter-33/10-theory_version.pl +1 -1
- package/examples/book/chapter-34/01-travel_status.pl +1 -1
- package/examples/book/chapter-34/02-require_route.pl +1 -1
- package/examples/book/chapter-34/03-regional_total.pl +1 -1
- package/examples/book/chapter-35/01-term_shape.pl +1 -1
- package/examples/book/chapter-36/01-program.pl +1 -1
- package/examples/book/chapter-36/02-program-2.pl +1 -1
- package/examples/book/chapter-36/03-program-3.pl +1 -1
- package/examples/book/chapter-37/01-write_event.pl +1 -1
- package/examples/book/chapter-38/01-city.pl +1 -1
- package/examples/cdcl-sat-solver.pl +2 -2
- package/examples/collatz-1000.pl +1 -1
- package/examples/equality-saturation.pl +1 -1
- package/examples/existential-rule.pl +1 -1
- package/examples/herbrand-semantics.pl +1 -1
- package/examples/herbrand-witnesses.pl +1 -1
- package/examples/iso-integer-arithmetic.pl +1 -1
- package/examples/knowledge-engineering-alignment-flow.pl +1 -1
- package/examples/language.pl +2 -2
- package/examples/law-of-cosines.pl +1 -1
- package/examples/linear-logic-resources.pl +1 -1
- package/examples/markov-logic-network.pl +1 -1
- package/examples/matrix-noncommutativity.pl +1 -1
- package/examples/partial-evaluator.pl +1 -1
- package/examples/peano-calculus.pl +1 -1
- package/examples/prime-range.pl +1 -1
- package/examples/register-allocation.pl +1 -1
- package/examples/route-planning.pl +1 -1
- package/examples/sat-solver-dpll.pl +1 -1
- package/examples/symbolic-derivative.pl +1 -1
- package/examples/term-tools.pl +1 -1
- package/examples/trust-flow-provenance-threshold.pl +1 -1
- package/examples/vector-similarity.pl +1 -1
- package/examples/web-names.pl +1 -1
- package/examples/workplace-compliance.pl +1 -1
- package/index.d.ts +68 -68
- package/index.js +1 -1
- package/package.json +2 -2
- package/playground.html +10 -10
- package/src/cli.js +4 -4
- package/src/explain.js +4 -4
- package/src/index.js +4 -4
- package/src/iso.js +1 -1
- package/src/library.js +7 -7
- package/src/parser.js +1 -1
- package/src/playground-worker.js +2 -2
- package/src/solver.js +4 -4
- package/src/term.js +1 -1
- package/test/conformance/README.md +6 -6
- package/test/conformance/THIRD_PARTY.md +4 -4
- package/test/conformance/cases/iso/logtalk_abolish.pl +1 -1
- package/test/conformance/cases/iso/logtalk_arg_unification.pl +1 -1
- package/test/conformance/cases/iso/logtalk_assert_order.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_chars.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_codes.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_concat.pl +1 -1
- package/test/conformance/cases/iso/logtalk_atom_length.pl +1 -1
- package/test/conformance/cases/iso/logtalk_bagof.pl +1 -1
- package/test/conformance/cases/iso/logtalk_char_code.pl +1 -1
- package/test/conformance/cases/iso/logtalk_clause.pl +1 -1
- package/test/conformance/cases/iso/logtalk_compare_standard_order.pl +1 -1
- package/test/conformance/cases/iso/logtalk_copy_term_semantics.pl +1 -1
- package/test/conformance/cases/iso/logtalk_current_predicate.pl +1 -1
- package/test/conformance/cases/iso/logtalk_current_streams.pl +1 -1
- package/test/conformance/cases/iso/logtalk_findall.pl +1 -1
- package/test/conformance/cases/iso/logtalk_number_chars.pl +1 -1
- package/test/conformance/cases/iso/logtalk_number_codes.pl +1 -1
- package/test/conformance/cases/iso/logtalk_occurs_check.pl +1 -1
- package/test/conformance/cases/iso/logtalk_once.pl +1 -1
- package/test/conformance/cases/iso/logtalk_operators.pl +1 -1
- package/test/conformance/cases/iso/logtalk_prolog_flags.pl +1 -1
- package/test/conformance/cases/iso/logtalk_repeat.pl +1 -1
- package/test/conformance/cases/iso/logtalk_retract.pl +1 -1
- package/test/conformance/cases/iso/logtalk_setof.pl +1 -1
- package/test/conformance/cases/iso/logtalk_sub_atom.pl +1 -1
- package/test/conformance/cases/iso/logtalk_term_comparison.pl +1 -1
- package/test/conformance/cases/iso/logtalk_term_variables.pl +1 -1
- package/test/conformance/cases/iso/logtalk_univ.pl +1 -1
- package/test/conformance/cases/strings/064_reusable_string_builtins.pl +3 -3
- package/test/conformance/cases/strings/071_string_edges.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_arity_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_bad_indicator.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_name_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_negative_arity.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_abolish_unbound_arity.pl +1 -1
- package/test/conformance/errors/iso/logtalk_arg_index_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_arg_number.pl +1 -1
- package/test/conformance/errors/iso/logtalk_asserta_bad_body.pl +1 -1
- package/test/conformance/errors/iso/logtalk_asserta_noncallable.pl +1 -1
- package/test/conformance/errors/iso/logtalk_assertz_noncallable.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_atom_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_character_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_chars_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_atom_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_bad_code.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_integer_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_codes_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_left_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_right_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_concat_whole_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_atom_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_integer_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_negative.pl +1 -1
- package/test/conformance/errors/iso/logtalk_atom_length_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_bagof_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_bagof_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_character_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_integer_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_negative.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_number_character.pl +1 -1
- package/test/conformance/errors/iso/logtalk_char_code_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_clause_noncallable_body.pl +1 -1
- package/test/conformance/errors/iso/logtalk_clause_noncallable_head.pl +1 -1
- package/test/conformance/errors/iso/logtalk_compare_order_domain.pl +1 -1
- package/test/conformance/errors/iso/logtalk_compare_order_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_flag_compound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_flag_name_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_flag_unknown.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_input_bad_stream.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_op_bad_specifier.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_op_high_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_output_bad_stream.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_predicate_bad_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_predicate_negative_arity.pl +1 -1
- package/test/conformance/errors/iso/logtalk_current_predicate_scalar.pl +1 -1
- package/test/conformance/errors/iso/logtalk_findall_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_findall_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_functor_arity_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_functor_compound_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_functor_float_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_character_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_number_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_partial.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_syntax.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_chars_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_bad_code.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_list_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_number_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_partial.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_syntax.pl +1 -1
- package/test/conformance/errors/iso/logtalk_number_codes_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_once_noncallable.pl +1 -1
- package/test/conformance/errors/iso/logtalk_once_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_bad_specifier.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_high_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_negative_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_priority_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_unbound_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_unbound_priority.pl +1 -1
- package/test/conformance/errors/iso/logtalk_op_unbound_specifier.pl +1 -1
- package/test/conformance/errors/iso/logtalk_retract_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_retract_unbound_head.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_name_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_unbound_name.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_unbound_value.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_unknown.pl +1 -1
- package/test/conformance/errors/iso/logtalk_set_flag_value.pl +1 -1
- package/test/conformance/errors/iso/logtalk_setof_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_before_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_negative.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_result_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_source_type.pl +1 -1
- package/test/conformance/errors/iso/logtalk_sub_atom_unbound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_term_variables_improper.pl +1 -1
- package/test/conformance/errors/iso/logtalk_term_variables_nonlist.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_head_compound.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_head_float.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_head_integer.pl +1 -1
- package/test/conformance/errors/iso/logtalk_univ_single_compound.pl +1 -1
- package/test/conformance/expected/strings/064_reusable_string_builtins.pl +1 -1
- package/test/run-conformance-report.mjs +4 -4
- package/test/run-conformance.mjs +3 -3
- package/test/run-playground.mjs +3 -3
- package/test/run-rdf-tools.mjs +15 -15
- package/test/run-regression.mjs +35 -35
- package/the-art-of-eyelang.md +136 -136
- package/tools/README.md +2 -2
- package/tools/extract-book-examples.mjs +4 -4
- package/tools/pl-to-rdf.mjs +2 -2
- package/tools/rdf-codec.mjs +8 -8
- package/tools/rdf-to-pl.mjs +9 -9
- package/why-eyelang.md +47 -47
|
@@ -24,7 +24,7 @@ export function buildConformanceReport() {
|
|
|
24
24
|
for (const { kind, expectedKind, expectedExt, column } of KINDS) {
|
|
25
25
|
const base = path.join(conformanceRoot, kind);
|
|
26
26
|
if (!fs.existsSync(base)) continue;
|
|
27
|
-
for (const file of
|
|
27
|
+
for (const file of listEyelangFiles(base)) {
|
|
28
28
|
const category = categoryOf(file);
|
|
29
29
|
const counts = ensureCategory(categories, category);
|
|
30
30
|
counts[column]++;
|
|
@@ -56,7 +56,7 @@ export function buildConformanceReport() {
|
|
|
56
56
|
|
|
57
57
|
export function formatConformanceReport(report = buildConformanceReport()) {
|
|
58
58
|
const lines = [
|
|
59
|
-
'#
|
|
59
|
+
'# Eyelang conformance report',
|
|
60
60
|
'',
|
|
61
61
|
'This report summarizes the file-based conformance corpus under `test/conformance/`.',
|
|
62
62
|
'',
|
|
@@ -77,12 +77,12 @@ export function formatConformanceReport(report = buildConformanceReport()) {
|
|
|
77
77
|
return `${lines.join('\n')}\n`;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function
|
|
80
|
+
function listEyelangFiles(base, dir = base) {
|
|
81
81
|
const files = [];
|
|
82
82
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
83
83
|
const full = path.join(dir, entry.name);
|
|
84
84
|
if (entry.isDirectory()) {
|
|
85
|
-
files.push(...
|
|
85
|
+
files.push(...listEyelangFiles(base, full));
|
|
86
86
|
} else if (entry.isFile() && entry.name.endsWith('.pl')) {
|
|
87
87
|
files.push(path.relative(base, full).split(path.sep).join('/'));
|
|
88
88
|
}
|
package/test/run-conformance.mjs
CHANGED
|
@@ -26,7 +26,7 @@ export function runConformance(reporter = new TestReporter(), requestedFilter =
|
|
|
26
26
|
function listCaseFiles(kind, filter = null) {
|
|
27
27
|
const base = path.join(root, 'conformance', kind);
|
|
28
28
|
if (!fs.existsSync(base)) return [];
|
|
29
|
-
return
|
|
29
|
+
return listEyelangFiles(base)
|
|
30
30
|
.filter((name) => matchesFilter(kind, name, filter))
|
|
31
31
|
.sort();
|
|
32
32
|
}
|
|
@@ -42,12 +42,12 @@ function matchesFilter(kind, name, filter) {
|
|
|
42
42
|
|| `${label}/${stem}`.includes(filter);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
function
|
|
45
|
+
function listEyelangFiles(base, dir = base) {
|
|
46
46
|
const files = [];
|
|
47
47
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
48
48
|
const full = path.join(dir, entry.name);
|
|
49
49
|
if (entry.isDirectory()) {
|
|
50
|
-
files.push(...
|
|
50
|
+
files.push(...listEyelangFiles(base, full));
|
|
51
51
|
} else if (entry.isFile() && entry.name.endsWith('.pl')) {
|
|
52
52
|
files.push(path.relative(base, full).split(path.sep).join('/'));
|
|
53
53
|
}
|
package/test/run-playground.mjs
CHANGED
|
@@ -25,7 +25,7 @@ export async function runPlayground(reporter = new TestReporter()) {
|
|
|
25
25
|
assertNotIncludes(html, 'URL.createObjectURL(new Blob([workerCode]', 'inline blob worker');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
await reporter.testAsync('worker loads append/3 from the
|
|
28
|
+
await reporter.testAsync('worker loads append/3 from the Eyelang library', async () => {
|
|
29
29
|
const result = executePlaygroundRequest({
|
|
30
30
|
source: 'answer(X) :- append([a], [b], X).\n',
|
|
31
31
|
options: { goal: 'answer(X)' },
|
|
@@ -35,7 +35,7 @@ export async function runPlayground(reporter = new TestReporter()) {
|
|
|
35
35
|
assertEqual(result.elapsedMs, 1, 'elapsed time');
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
await reporter.testAsync('worker keeps the
|
|
38
|
+
await reporter.testAsync('worker keeps the Eyelang library across runs', async () => {
|
|
39
39
|
const first = executePlaygroundRequest({
|
|
40
40
|
source: 'answer(X) :- reverse([a, b, c], X).\n',
|
|
41
41
|
options: { goal: 'answer(X)' },
|
|
@@ -94,7 +94,7 @@ export async function runPlayground(reporter = new TestReporter()) {
|
|
|
94
94
|
await withStaticServer(async (baseUrl) => {
|
|
95
95
|
const modules = await crawlModuleGraph(new URL('src/playground-worker.js?playground=test', baseUrl));
|
|
96
96
|
assert(modules.size >= 10, `expected a substantial worker module graph, got ${modules.size}`);
|
|
97
|
-
assert([...modules].some((url) => url.includes('/src/library.js')), '
|
|
97
|
+
assert([...modules].some((url) => url.includes('/src/library.js')), 'Eyelang library missing from worker graph');
|
|
98
98
|
assert([...modules].some((url) => url.includes('/src/solver.js')), 'solver missing from worker graph');
|
|
99
99
|
});
|
|
100
100
|
});
|
package/test/run-rdf-tools.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { compileRdfDocumentToEyelang, compileRdfToEyelang } from '../tools/rdf-to-pl.mjs';
|
|
4
|
+
import { extractEyelangRdf } from '../tools/pl-to-rdf.mjs';
|
|
5
5
|
import { run } from '../src/index.js';
|
|
6
6
|
import { TestReporter, isMainModule } from './test-style.mjs';
|
|
7
7
|
|
|
@@ -9,29 +9,29 @@ export async function runRdfTools(reporter = new TestReporter()) {
|
|
|
9
9
|
reporter.section('RDF tools');
|
|
10
10
|
reporter.test('N-Quads survives an include-source round trip', () => {
|
|
11
11
|
const input = '<https://example/s> <https://example/p> "chat"@fr <https://example/g> .\n_:a <https://example/value> "42"^^<http://www.w3.org/2001/XMLSchema#integer> .\n';
|
|
12
|
-
const output = run(
|
|
13
|
-
equal(
|
|
12
|
+
const output = run(compileRdfToEyelang(input, { scope: 'doc', includeSource: true }), { goal: 'rdf(S, P, O, G)' }).stdout;
|
|
13
|
+
equal(extractEyelangRdf(output), '<https://example/s> <https://example/p> "chat"@fr <https://example/g> .\n_:e646f63_61 <https://example/value> "42"^^<http://www.w3.org/2001/XMLSchema#integer> .\n');
|
|
14
14
|
});
|
|
15
15
|
reporter.test('default mode emits only rule-derived quads', () => {
|
|
16
16
|
const input = '<https://example/s> <https://example/parent> <https://example/o> .\n';
|
|
17
17
|
const rules = 'rdf(S, iri("https://example/ancestor"), O, G) :- rdf(S, iri("https://example/parent"), O, G).';
|
|
18
|
-
const output = run(
|
|
19
|
-
equal(
|
|
18
|
+
const output = run(compileRdfToEyelang(input, { rules }), { goal: 'rdf(S, P, O, G)' }).stdout;
|
|
19
|
+
equal(extractEyelangRdf(output), '<https://example/s> <https://example/ancestor> <https://example/o> .\n');
|
|
20
20
|
});
|
|
21
21
|
reporter.test('RDF 1.2 terms survive an include-source round trip', () => {
|
|
22
22
|
const input = 'VERSION "1.2"\n<https://example/s> <https://example/says> <<( _:a <https://example/text> "مرحبا"@ar--rtl )>> .\n';
|
|
23
|
-
const output = run(
|
|
24
|
-
equal(
|
|
23
|
+
const output = run(compileRdfToEyelang(input, { scope: 'doc', includeSource: true }), { goal: 'rdf(S, P, O, G)' }).stdout;
|
|
24
|
+
equal(extractEyelangRdf(output), '<https://example/s> <https://example/says> <<( _:e646f63_61 <https://example/text> "مرحبا"@ar--rtl )>> .\n');
|
|
25
25
|
});
|
|
26
26
|
reporter.test('nested RDF 1.2 triple terms survive a round trip', () => {
|
|
27
27
|
const input = '<https://example/s> <https://example/p> <<( <https://example/a> <https://example/b> <<( _:x <https://example/c> "line\\nfeed" )>> )>> .\n';
|
|
28
|
-
const output = run(
|
|
29
|
-
equal(
|
|
28
|
+
const output = run(compileRdfToEyelang(input, { scope: 'doc', includeSource: true }), { goal: 'rdf(S, P, O, G)' }).stdout;
|
|
29
|
+
equal(extractEyelangRdf(output), '<https://example/s> <https://example/p> <<( <https://example/a> <https://example/b> <<( _:e646f63_78 <https://example/c> "line\\nfeed" )>> )>> .\n');
|
|
30
30
|
});
|
|
31
31
|
reporter.test('RDF blank-node labels accept the full Unicode production', () => {
|
|
32
32
|
const input = '_:éclair <https://example/p> _:名.\n';
|
|
33
|
-
const output = run(
|
|
34
|
-
equal(
|
|
33
|
+
const output = run(compileRdfToEyelang(input, { scope: 'doc', includeSource: true }), { goal: 'rdf(S, P, O, G)' }).stdout;
|
|
34
|
+
equal(extractEyelangRdf(output), '_:e646f63_c3a9636c616972 <https://example/p> _:e646f63_e5908d .\n');
|
|
35
35
|
});
|
|
36
36
|
const generatedFixtures = [
|
|
37
37
|
['RDF 1.2 annotation example', 'rdf12-annotation', 'rdf12-annotation'],
|
|
@@ -46,7 +46,7 @@ export async function runRdfTools(reporter = new TestReporter()) {
|
|
|
46
46
|
for (const [label, programStem, inputStem] of generatedFixtures) {
|
|
47
47
|
const source = await fs.readFile(new URL(`../examples/input/${inputStem}.ttl`, import.meta.url), 'utf8');
|
|
48
48
|
const rules = await fs.readFile(new URL(`../examples/input/${inputStem}-rules.pl`, import.meta.url), 'utf8');
|
|
49
|
-
const generated = await
|
|
49
|
+
const generated = await compileRdfDocumentToEyelang(source, {
|
|
50
50
|
inputPath: `${inputStem}.ttl`,
|
|
51
51
|
scope: `${inputStem}.ttl`,
|
|
52
52
|
rules,
|
|
@@ -64,8 +64,8 @@ export async function runRdfTools(reporter = new TestReporter()) {
|
|
|
64
64
|
['RDFa', 'example.html', '<div prefix="ex: https://example/" about="ex:s"><a property="ex:p" href="https://example/o">o</a></div>'],
|
|
65
65
|
];
|
|
66
66
|
for (const [name, inputPath, source] of documents) {
|
|
67
|
-
const program = await
|
|
68
|
-
const output =
|
|
67
|
+
const program = await compileRdfDocumentToEyelang(source, { inputPath, includeSource: true, scope: inputPath, baseIRI: 'https://example/base' });
|
|
68
|
+
const output = extractEyelangRdf(run(program, { goal: 'rdf(S, P, O, G)' }).stdout);
|
|
69
69
|
reporter.test(`${name} input is accepted`, () => { if (!output) throw new Error('expected at least one RDF quad'); });
|
|
70
70
|
}
|
|
71
71
|
reporter.sectionTotal('RDF tool');
|