mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
compiler/error_msg_inst.m:
Fix a bug that caused the suffix that all paths in two predicates
were supposed to add at the logical end of the constructed pieces
(though it could be followed by some punctuation) to *not* be added
to the constructed pieces on some paths. Since with our current approach,
the suffix for one inst in a list of insts can be the description
of *all the insts following it in the list*, this bug could delete
not just punctuation, but entire insts from the output. This did actually
happen for the invalid/html text case below.
Fix a problem that could cause each inst in a list of insts
to be indented one more level than the previous inst, which can be
very confusing.
Delete the comma from "instname, which expands to ...". When this output
occurs in an argument list, the presence of the comma can make it
harder to recognize where one argument ends and the next argument begins.
Factor out some common code.
Add an XXX noting a problem.
Fix documentation.
compiler/parse_tree_out_inst.m:
Provide two functions for use by error_msg_inst.m.
compiler/prog_mode.m:
Fix a comment.
tests/invalid/html.m:
Fix the description of the problem we are testing for.
tests/invalid/html.err_exp:
Expect the fix for the "omitted insts" bug above.
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
Do not expect the deleted comma.
61 lines
1.9 KiB
Mathematica
61 lines
1.9 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ff=unix ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module html.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
:- import_module list.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% Elements that are allowed inside the body tag of an HTML document
|
|
%
|
|
:- type body_elem
|
|
---> ul(list(body_elem)) % Unordered list tag
|
|
; li(list(body_elem)) % List item tag
|
|
; text(string).
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% Top-level body elements.
|
|
% The li tag is not allowed as a top-level element. It must be a direct
|
|
% child of the ul tag.
|
|
%
|
|
:- inst top_body_elem for body_elem/0
|
|
---> ul(non_empty_list(li(top_body_elem)))
|
|
% The ul tag allows only li tags as top level children.
|
|
|
|
; text(ground).
|
|
|
|
:- inst li(I) for body_elem/0
|
|
---> li(non_empty_list(I)).
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- inst non_empty_list(I) for list/1
|
|
---> [I | list_skel(I)].
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- implementation.
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
main(!IO).
|
|
|
|
:- func init_body_elem =
|
|
(list(body_elem)::out(non_empty_list(top_body_elem))) is det.
|
|
|
|
init_body_elem =
|
|
% [ul([li([text("List item")])])]. % This line compiles without errors
|
|
|
|
[ul([li([])])].
|
|
% Mantis bug #528 was about this line causing a compiler abort.
|
|
% Since that bug has been fixed, the expected result is an error
|
|
% message about the mode error on this line (the `li' tag requires
|
|
% a non-empty list as its argument).
|