Skip to content

Commit 95281ce

Browse files
jjtoltonclaude
andcommitted
Add WG17 spec documentation to double bar tests
Document the abstract syntax from the spec: term = double quoted list, bar, bar, term ; This confirms that the RIGHT side (tail) can be any term at priority 0, including atoms and numbers, not just variables. Reference WG17 2025-06-02 decision accepting option 1 (only after double quotes). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b4fe184 commit 95281ce

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/tests/double_bar.pl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
:- use_module(test_framework).
44

55
% Tests for the double bar || operator
6-
% Based on: https://www.complang.tuwien.ac.at/ulrich/iso-prolog/double_bar
6+
% Spec: https://www.complang.tuwien.ac.at/ulrich/iso-prolog/double_bar
7+
%
8+
% Abstract syntax (from spec):
9+
% term = double quoted list, bar, bar, term ;
10+
% Priority: 0, 0, 0
11+
%
12+
% The LEFT side must be a double quoted list.
13+
% The RIGHT side (tail) can be any term at priority 0, including:
14+
% - Variables: "abc"||K
15+
% - Strings (chained): "a"||"b"||"c"
16+
% - Atoms: "hello"||world (valid per abstract syntax)
17+
% - Numbers: "abc"||123
18+
%
19+
% WG17 2025-06-02: Accepts option 1 (only after double quotes)
720

821
test("basic double bar with variable tail", (
922
L = "abc"||K,
@@ -20,6 +33,8 @@
2033
L == K
2134
)).
2235

36+
% Atom tail: valid per abstract syntax "term = dql, bar, bar, term"
37+
% The right-hand term can be any term at priority 0, including atoms.
2338
test("double bar with atom tail", (
2439
L = "hello"||world,
2540
L = [h,e,l,l,o|world]
@@ -163,6 +178,7 @@
163178
X = [c]
164179
)).
165180

181+
% Numeric tail: valid per abstract syntax (right-hand term can be any term)
166182
test("double bar chars mode with numeric tail", (
167183
L = "abc"||123,
168184
L = [a,b,c|123]

src/tests/double_bar_codes.pl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
% Tests for the double bar || operator in codes mode
2+
% Spec: https://www.complang.tuwien.ac.at/ulrich/iso-prolog/double_bar
3+
%
4+
% Abstract syntax (from spec):
5+
% term = double quoted list, bar, bar, term ;
6+
% Priority: 0, 0, 0
7+
%
8+
% The LEFT side must be a double quoted list.
9+
% The RIGHT side (tail) can be any term at priority 0, including:
10+
% - Variables: "abc"||K
11+
% - Strings (chained): "a"||"b"||"c"
12+
% - Atoms: "abc"||xyz (valid per abstract syntax)
13+
% - Numbers: "abc"||123
14+
%
15+
% WG17 2025-06-02: Accepts option 1 (only after double quotes)
16+
%
17+
% Note: Format helpers defined BEFORE set_prolog_flag so format strings
18+
% are parsed as chars (format/2 requires char lists, not code lists).
19+
120
:- use_module(library(format)).
221

322
run_test(Name, Goal) :-

0 commit comments

Comments
 (0)