Skip to content

Better error messages for table conflicts #23

Description

@kylejlin

Currently, debugging table conflicts is a horrible user experience, due to poor error messages, like this:

  (base) kyle@MacBookPro ave_v3 % cargo test
   Compiling ave_v3 v0.1.0 (/Users/kyle/zo/ave_v3)
error: failed to run custom build command for `ave_v3 v0.1.0 (/Users/kyle/zo/ave_v3)`

Caused by:
  process didn't exit successfully: `/Users/kyle/zo/target/debug/build/ave_v3-02ff28b9b95dcec2/build-script-build` (exit status: 101)
  --- stderr

  thread 'main' panicked at ave_v3/build.rs:38:21:
  Invalid Kiki file ./src/raw_parser.kiki. Error: TableConflict(
      TableConflictErr {
          state_index: StateIndex(
              151,
          ),
          items: (
              StateItem {
                  rule_index: Original(
                      50,
                  ),
                  lookahead: Terminal(
                      DollarlessTerminalName(
                          "Comma",
                      ),
                  ),
                  dot: 0,
              },
              StateItem {
                  rule_index: Original(
                      51,
                  ),
                  lookahead: Terminal(
                      DollarlessTerminalName(
                          "Comma",
                      ),
                  ),
                  dot: 0,
              },
          ),
          
          // ...lots of hard-to-understand information...
      },
  )

We should print out the conflicting rules (not just their indices).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions