From 02ebb9bb630de5bc589e509e10c1d82629ab6487 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 31 Jul 2021 14:00:52 +0900 Subject: Detect duplicate names between terminals and non-terminals --- driver/parser_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'driver/parser_test.go') diff --git a/driver/parser_test.go b/driver/parser_test.go index 8145d7b..5763d63 100644 --- a/driver/parser_test.go +++ b/driver/parser_test.go @@ -366,6 +366,32 @@ a ; foo: "foo"; bar: "bar"; +`, + specErr: true, + }, + // A terminal and a non-terminal (start symbol) are duplicates. + { + specSrc: ` +a + : foo + ; +foo: "foo"; +a: "a"; +`, + specErr: true, + }, + // A terminal and a non-terminal (not start symbol) are duplicates. + { + specSrc: ` +a + : foo + ; +b + : bar + ; +foo: "foo"; +bar: "bar"; +b: "a"; `, specErr: true, }, -- cgit v1.2.3