diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-31 14:00:52 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-07-31 14:00:52 +0900 |
commit | 02ebb9bb630de5bc589e509e10c1d82629ab6487 (patch) | |
tree | 8905b07cdcfba957ecc86f9a4b0245f64409bbc0 /driver/parser_test.go | |
parent | Prevent terminals used in productions from being skipped (diff) | |
download | urubu-02ebb9bb630de5bc589e509e10c1d82629ab6487.tar.gz urubu-02ebb9bb630de5bc589e509e10c1d82629ab6487.tar.xz |
Detect duplicate names between terminals and non-terminals
Diffstat (limited to 'driver/parser_test.go')
-rw-r--r-- | driver/parser_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ -369,6 +369,32 @@ 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, + }, } for i, tt := range tests { t.Run(fmt.Sprintf("#%v", i), func(t *testing.T) { |