Files
mercury/tests/invalid/invalid_float_literal.err_exp
Zoltan Somogyi 35a4f3a2dd Fix some error messages for malformed pragmas.
compiler/parse_pragma.m:
    Improve error handling in several respects.

    First, for several kinds of pragmas the only error message we printed
    was some form of "something went wrong". Fix this by generating messages
    that say what part of the pragma has a problem, and what that problem is.

    Second, specify the "where" part more precisely, as a nested context
    (in construct A: in construct B: etc).

    Third, make the text of error messages more consistent, using patterns
    such as "expected abc, got def", and "In the Nth argument of xyz:".

    Fourth, don't stop looking for errors after finding one; keep looking
    for others.

    Also, replace a bunch of if-then-elses with switches, and break up
    a too-large predicate.

compiler/parse_sym_name.m:
    Add parse_sym_name_and_no_args, a version of the existing predicate
    try_parse_sym_name_and_no_args that generates an error message if it
    does not find what it is asked to look for.

    Use the same consistent error message phraseology as above (which we
    also use elsewhere in the compiler).

compiler/parse_item.m:
    Put a newline at the end of context pieces such as "In clause head:",
    so that the "error:" that follows is not buried in the middle of a line.

tests/invalid/bad_pragma.{m,err_exp}:
    Add a news test case for some of the updated error messages.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/invalid/bad_foreign_enum.m:
    Add another bad foreign_enum to this test.

tests/invalid/bad_detism_category.err_exp:
tests/invalid/bad_foreign_code.err_exp:
tests/invalid/bad_foreign_enum.err_exp:
tests/invalid/bad_foreign_export.err_exp:
tests/invalid/bad_foreign_export_enum.err_exp:
tests/invalid/bad_foreign_import_module.err_exp:
tests/invalid/bad_foreign_proc.err_exp:
tests/invalid/bad_foreign_type.err_exp:
tests/invalid/bad_with_inst.err_exp:
tests/invalid/impl_def_literal_syntax.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/require_tailrec_invalid.err_exp:
tests/invalid/some.err_exp:
tests/invalid/specified.err_exp:
tests/invalid/vars_in_wrong_places.err_exp:
    Expect the updated error messages.
2020-08-23 10:29:34 +10:00

58 lines
3.5 KiB
Plaintext

invalid_float_literal.m:012: Error: no clauses for function `foo1'/0.
invalid_float_literal.m:013: Error: no clauses for function `foo2'/0.
invalid_float_literal.m:014: Error: no clauses for function `foo3'/0.
invalid_float_literal.m:015: Error: no clauses for function `foo4'/0.
invalid_float_literal.m:016: Error: no clauses for function `foo5'/0.
invalid_float_literal.m:017: Error: no clauses for function `foo6'/0.
invalid_float_literal.m:018: Error: no clauses for function `foo7'/0.
invalid_float_literal.m:019: Error: no clauses for function `foo8'/0.
invalid_float_literal.m:020: Error: no clauses for function `foo9'/0.
invalid_float_literal.m:021: Error: no clauses for function `foo10'/0.
invalid_float_literal.m:022: Error: no clauses for function `foo11'/0.
invalid_float_literal.m:023: Error: no clauses for function `foo12'/0.
invalid_float_literal.m:027: Syntax error at token `. ': unexpected token at
invalid_float_literal.m:027: start of (sub)term.
invalid_float_literal.m:027: Syntax error: fractional part of float terminated
invalid_float_literal.m:027: by underscore.
invalid_float_literal.m:029: Syntax error at token `. ': unexpected token at
invalid_float_literal.m:029: start of (sub)term.
invalid_float_literal.m:029: Syntax error: unterminated exponent in float
invalid_float_literal.m:029: literal.
invalid_float_literal.m:031: In clause head:
invalid_float_literal.m:031: error: expected a symbol name, got `12'.
invalid_float_literal.m:031: Syntax error: underscore before exponent.
invalid_float_literal.m:033: In clause head:
invalid_float_literal.m:033: error: expected a symbol name, got `_12'.
invalid_float_literal.m:033: Syntax error: unterminated exponent in float
invalid_float_literal.m:033: literal.
invalid_float_literal.m:035: In clause head:
invalid_float_literal.m:035: error: expected a symbol name, got `_123'.
invalid_float_literal.m:035: Syntax error: unterminated decimal literal.
invalid_float_literal.m:037: In clause head:
invalid_float_literal.m:037: error: expected a symbol name, got `123'.
invalid_float_literal.m:037: Syntax error: underscore following decimal point.
invalid_float_literal.m:039: In clause head:
invalid_float_literal.m:039: error: expected a symbol name, got `123'.
invalid_float_literal.m:039: Syntax error: unterminated decimal literal.
invalid_float_literal.m:041: Error: clause for predicate `-'/2
invalid_float_literal.m:041: without corresponding `:- pred' declaration.
invalid_float_literal.m:041: Inferred :- pred -(T1, int).
invalid_float_literal.m:041: Syntax error: unterminated exponent in float
invalid_float_literal.m:041: literal.
invalid_float_literal.m:043: Error: clause for predicate `+'/2
invalid_float_literal.m:043: without corresponding `:- pred' declaration.
invalid_float_literal.m:043: Inferred :- pred +(T1, int).
invalid_float_literal.m:043: Syntax error: unterminated exponent in float
invalid_float_literal.m:043: literal.
invalid_float_literal.m:045: In clause head:
invalid_float_literal.m:045: error: expected a symbol name, got `12'.
invalid_float_literal.m:045: Syntax error: underscore before exponent.
invalid_float_literal.m:047: In clause head:
invalid_float_literal.m:047: error: expected a symbol name, got `_12'.
invalid_float_literal.m:047: Syntax error: unterminated exponent in float
invalid_float_literal.m:047: literal.
invalid_float_literal.m:049: In clause head:
invalid_float_literal.m:049: error: expected a symbol name, got `_12'.
invalid_float_literal.m:049: Syntax error: unterminated exponent in float
invalid_float_literal.m:049: literal.