[m-rev.] diff: throw a software_error from dir.expand_braces/1

Julien Fischer jfischer at opturion.com
Mon Oct 14 16:44:35 AEDT 2019


Throw a software_error from dir.expand_braces/1.

library/dir.m:
     As above, previously this just threw a string on a brace mismatch.

tests/hard_coded/brace.m:
     Replace the use of '__' as a module qualifier.

Julien.

diff --git a/library/dir.m b/library/dir.m
index d03d1d7..0f1d0fc 100644
--- a/library/dir.m
+++ b/library/dir.m
@@ -1987,7 +1987,7 @@ find_matching_brace(Chars, Alternatives, Left) :-
      list(char)::in, int::in, list(list(char))::out, list(char)::out) is det.

  find_matching_brace_or_comma([], _, _, _, _, _) :-
-    throw("no matching brace").
+    error("dir.expand_braces: mismatched braces").
  find_matching_brace_or_comma([Char | Chars], Alternatives0, CurAlternative,
          BraceLevel, Alternatives, Left) :-
      ( if Char = '}' then
diff --git a/library/math.m b/library/math.m
diff --git a/tests/hard_coded/brace.m b/tests/hard_coded/brace.m
index 3dff5bb..bf72516 100644
--- a/tests/hard_coded/brace.m
+++ b/tests/hard_coded/brace.m
@@ -16,22 +16,22 @@
  :- import_module list.

  main(!IO) :-
-    list__foldl(expand_print, test_inputs, !IO).
+    list.foldl(expand_print, test_inputs, !IO).

  :- pred expand_print(string::in, io::di, io::uo) is det.

  expand_print(Arg, !IO) :-
-    io__write_string(Arg, !IO),
-    io__nl(!IO),
+    io.write_string(Arg, !IO),
+    io.nl(!IO),
      write_expansions(expand_braces(Arg), !IO).

  :- pred write_expansions(list(string)::in, io::di, io::uo) is det.

  write_expansions([], !IO).
  write_expansions([Str | Strs], !IO) :-
-    io__write_string("  ", !IO),
-    io__write_string(Str, !IO),
-    io__nl(!IO),
+    io.write_string("  ", !IO),
+    io.write_string(Str, !IO),
+    io.nl(!IO),
      write_expansions(Strs, !IO).

  :- func test_inputs = list(string).


More information about the reviews mailing list