Skip to content

Providing multiple separators for a class is not handled correctly #571

Description

@MatthewDaggitt
position token Name         (letter (letter | digit | '_')*) ;
separator Name "";
separator nonempty Name ",";

generates Haskell code of the form:

instance Print [Vehicle.Syntax.External.Abs.Name] where
  prt _ [] = concatD []
  prt _ [x] = concatD [prt 0 x]
  prt _ (x:xs) = concatD [prt 0 x, prt 0 xs]
  prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]

Obviously case 4 will never fire as it is handled by case 3.

I guess BNFC should either error if you provide two separator declarations for the same class or the backend should be patched to handle it. I'm unsure whether the same problem exists in other backends.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions