mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

feat: Add chevrotain parser with Unicode support!

Open sidharthv96 opened this issue 3 years ago • 3 comments

:bookmark_tabs: Summary

Introduces chevrotain as a possible parser instead of JISON with Unicode support!

Experimental support only in the least used Pie and Info diagram.

image

Related issues

  • #873
  • #3213
  • #3047

:straight_ruler: Design Decisions

The new parser has a compatability layer to act as a drop in replacement for the existing JISON parser. So no changes in mermaid code will be required outside of the corresponding diagram's folder.

  • Unicode support - Emojis!!
  • Completely typed code
  • Easy to debug
  • Friendly logic, written in TS
  • Faster
  • ESM support
  • No need of the loader headache

:clipboard: Tasks

Make sure you

  • [x] :book: have read the contribution guidelines
  • [x] :computer: have added unit/e2e tests (if appropriate)
  • [x] :bookmark: targeted develop branch

sidharthv96 avatar Sep 08 '22 16:09 sidharthv96

This would be great also because it allows for some inheritance. Could hopefully get rid of all the duplication so much of the lexers and parsers. Would also make it easy to implement things that are common to all diagrams (headers, footers, titles, etc.)

I wonder if we could use the syntax diagrams in the documentation (e.g. to show the syntax for diagrams)

weedySeaDragon avatar Oct 05 '22 01:10 weedySeaDragon

FYI - I was intrigued by this, so started learning and working with it. I'm working on the parser for the ER diagrams (since that's what I've been working with). I'm writing pretty detailed spec/tests for the parser so that we can refactor and re-use the common parts for other diagrams. I've written it using the CST/Visitor semantics.

When I have it working I'll put up a draft PR. If you want to see what I've got before then, just let me know.

weedySeaDragon avatar Oct 06 '22 02:10 weedySeaDragon

This will come sometime down the line. We are changing a lot right now and we need to stabilize first, after that I will ot this and do a bigger POC for evaluation.

knsv avatar Oct 07 '22 13:10 knsv