From adb12c2c1b2873d8775f55c02f54e6690687f1a2 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Wed, 28 Jul 2021 01:54:39 +0900 Subject: Detect duplicate production errors --- driver/parser_test.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'driver/parser_test.go') diff --git a/driver/parser_test.go b/driver/parser_test.go index 272a14d..73d8fac 100644 --- a/driver/parser_test.go +++ b/driver/parser_test.go @@ -270,6 +270,48 @@ s : foo #ast #(s $1...) ; foo: "foo"; +`, + specErr: true, + }, + // A production must not have a duplicate alternative. + { + specSrc: ` +s + : foo + | foo + ; +foo: "foo"; +`, + specErr: true, + }, + // A production must not have a duplicate alternative. + { + specSrc: ` +a + : foo + ; +b + : + | + ; +foo: "foo"; +`, + specErr: true, + }, + // A production must not have a duplicate alternative. + { + specSrc: ` +a + : foo + ; +b + : bar + ; +a + : foo + ; +foo: "foo"; +bar: "bar"; `, specErr: true, }, -- cgit v1.2.3