STR-341: sglri does not give nice error message if there are multiple ambiguities
Given the following input:
{
foo = if a then b else c.d;
bar = if a then b else c.d;
}the attached Nix SDF grammar gives the following error:
$ sdf2table -m Nix -s -i nix.sdf -o nix.tbl
$ sglri –sglr -A -p nix.tbl -i test.nix
error: An error occured, but the error summary cannot be presented in a nice way. Please report this as a bug.
Structured error summary: summary(“sglr”,“test.nix”,[error(“Ambiguity”,[localized(“Expr “.” Id -> Expr {cons(“Select”)};“if” Expr “then” Expr “else” Expr -> Expr {cons(“If”)}”,area-in-file(“test.nix”,area(3,8,3,28,40,20))),localized(“Expr “.” Id -> Expr {cons(“Select”)};“if” Expr “then” Expr “else” Expr -> Expr {cons(“If”)}”,area-in-file(“test.nix”,area(2,8,2,28,10,20)))])])But if either the foo or bar line is removed or commented out, the error is much nicer:
$ sglri –sglr -A -p nix.tbl -i test.nix
[ sglri | error ] test.nix: Ambiguity found at line 2, column 8
[ sglri | error ] {
[ sglri | error ] foo = if a then b else c.d;
[ sglri | error ] ^
[ sglri | error ] Alternatives are:
[ sglri | error ] Expr “.” Id -> Expr {cons(“Select”)}
[ sglri | error ] “if” Expr “then” Expr “else” Expr -> Expr {cons(“If”)}This is correct (and very helpful) because the grammar actually is ambiguous.
Submitted on 16 July 2005 at 17:27