Skip to content

[ER Diagram] relationship with 1 -- causes parsing error #7482

@DavidSeptimus

Description

@DavidSeptimus

Description

In an ER Diagram, adding a relationship that contains a left-hand 1 alias followed by non-aliased -- or .. with a space between the two (e.g. 1 -- 1+) causes a parsing error.

Steps to reproduce

  1. Create an ER Diagram
  2. Add a relationship such as A 1 -- 1+ B: label
  3. Get a parsing error on the first 1

Screenshots

Image
Error: Error: Parse error on line 7:
...1-- 1+ B: labelA 1 -- 1+ B: label
----------------------^
Expecting 'EOF', 'SPACE', 'NEWLINE', 'COLON', 'STYLE_SEPARATOR', 'BLOCK_START', 'SQS', 'SQE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'CLASSDEF', 'UNICODE_TEXT', 'CLASS', 'STYLE', 'NUM', 'ENTITY_NAME', 'DECIMAL_NUM', 'ENTITY_ONE', 'ZERO_OR_ONE', 'ZERO_OR_MORE', 'ONE_OR_MORE', 'ONLY_ONE', 'MD_PARENT', got 'IDENTIFYING'

Code Sample

https://develop.git.mermaid.live/edit#pako:eNpVUMtOwzAQ_BVrpZ5II7t5Ob6VcuUHkC8GL2nUeF1tHfGI8u-EUBCd085qZmc1E7xEj2AA-aF3HbtgydJmI94in3rqLO2F2m6FuhP3RgzuGYergGK6EYlbFWTQce_BJB4xg4Ac3DeFyZIQFtIRA1owy-gdnyxYmhfP2dFTjOHXxnHsjmBe3XBZ2Hj2LuH1z78tI3nkQxwpgdlV6w0wE7yDUa3KpZZNVbR11Wpd6Aw-wDQybxfURbkrZVGXcwafa6jMdVPJf1AZoO9T5Mefltay5i-IsF0e

erDiagram

%% working
A 1-- 1+ B: label

%% not working
A 1 -- 1+ B: label

Setup

  • Mermaid version: 11.13.0
  • Browser and Version: Chrome 146.0.7680.72

Suggested Solutions

No response

Additional Context

This was introduced in 11.13.0, likely by #7375, but #6984 affects similar parsing rules as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageNeeds to be verified, categorized, etcType: Bug / ErrorSomething isn't working or is incorrect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions