Skip to content

Commit 1798a9b

Browse files
committed
[fs.path.generic] Refactor generic pathname grammar to remove redundancy and ambiguity.
1 parent 660d97e commit 1798a9b

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

source/iostreams.tex

+14-19
Original file line numberDiff line numberDiff line change
@@ -10651,9 +10651,7 @@
1065110651

1065210652
\begin{ncbnf}
1065310653
\nontermdef{pathname}\br
10654-
root-name root-directory\opt relative-path\opt\br
10655-
root-directory relative-path\opt\br
10656-
relative-path
10654+
root-name\opt{} root-directory\opt{} relative-path
1065710655
\end{ncbnf}
1065810656

1065910657
\begin{ncbnf}
@@ -10670,8 +10668,7 @@
1067010668
\begin{ncbnf}
1067110669
\nontermdef{relative-path}\br
1067210670
filename\br
10673-
relative-path directory-separator\br
10674-
relative-path directory-separator filename\br
10671+
filename directory-separator relative-path\br
1067510672
\textnormal{an empty path}
1067610673
\end{ncbnf}
1067710674

@@ -10682,20 +10679,18 @@
1068210679

1068310680
\begin{ncbnf}
1068410681
\nontermdef{directory-separator}\br
10685-
slash\br
10686-
slash directory-separator\br
10687-
preferred-separator\br
10688-
preferred-separator directory-separator
10682+
preferred-separator directory-separator\opt\br
10683+
fallback-separator directory-separator\opt
1068910684
\end{ncbnf}
1069010685

1069110686
\begin{ncbnf}
1069210687
\nontermdef{preferred-separator}\br
10693-
\textnormal{operating system dependent directory separator character\footnote{May be a synonym for \grammarterm{slash}.}}
10688+
\textnormal{operating system dependent directory separator character}
1069410689
\end{ncbnf}
1069510690

1069610691
\begin{ncbnf}
10697-
\nontermdef{slash}\br
10698-
\tcode{/}
10692+
\nontermdef{fallback-separator}\br
10693+
\textnormal{\tcode{/}, if \grammarterm{preferred-separator} is not \tcode{/}}
1069910694
\end{ncbnf}
1070010695

1070110696
\pnum
@@ -11281,8 +11276,8 @@
1128111276
p.make_preferred();
1128211277
std::cout << p << '\n';
1128311278
\end{codeblock}
11284-
On an operating system where \grammarterm{preferred-separator} is the same as
11285-
\grammarterm{directory-separator}, the output is:
11279+
On an operating system where \grammarterm{preferred-separator} is a slash,
11280+
the output is:
1128611281
\begin{codeblock}
1128711282
"foo/bar"
1128811283
"foo/bar"
@@ -11470,8 +11465,8 @@
1147011465
\pnum
1147111466
Generic format observer functions return strings formatted according to the
1147211467
generic pathname format (\ref{fs.path.generic}).
11473-
The forward slash (\tcode{'/'}) character is used as
11474-
the \grammarterm{directory-separator} character.
11468+
A single slash (\tcode{'/'}) character is used as
11469+
the \grammarterm{directory-separator}.
1147511470

1147611471
\pnum
1147711472
\begin{example} On an operating system that uses backslash as
@@ -11908,7 +11903,7 @@
1190811903
\end{codeblock}
1190911904
The above assertions will succeed.
1191011905
On Windows, the returned path's \grammarterm{directory-separator} characters
11911-
will be backslashes rather than forward slashes,
11906+
will be backslashes rather than slashes,
1191211907
but that does not affect \tcode{path} equality.
1191311908
\end{example}
1191411909

@@ -11976,8 +11971,8 @@
1197611971
The generic format is required to ensure lexicographical
1197711972
comparison works correctly. \end{note}
1197811973
\item Each successive \grammarterm{filename} element, if present.
11979-
\item An empty element, if one or more trailing non-root \grammarterm{slash}
11980-
characters are present.
11974+
\item An empty element, if a trailing non-root \grammarterm{directory-separator}
11975+
is present.
1198111976
\end{itemize}
1198211977

1198311978
\pnum

0 commit comments

Comments
 (0)