pyparsing / pyparsing

Python library for creating PEG parsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Badly rendered railroad diagram

sammorley-short opened this issue · comments

I’m trying to generate a pyparsing grammar railroad diagram, as described here, but when I run the example script the render comes out wrong with all these black boxes.

Script:

from pyparsing import Word, nums, alphas

street_address = Word(nums).set_name("house_number") + Word(alphas)[1, ...].set_name("street_name")
street_address.set_name("street_address")
street_address.create_diagram("street_address_diagram.html")

Render:

Screenshot 2023-04-12 at 22 57 17

(To install, I ran pip install "pyparsing[diagrams]")

What am I doing wrong?

What versions of pyparsing and railroad-diagrams are you using?

I just started seeing this recently also, but thought it was an artifact of my using Unicode characters in my grammar.

It looks like a problem with the latest release of railroad-diagrams. When I reverted to version 2.0.4, the diagrams were properly rendered.

pip install -U railroad-diagrams==2.0.4

I'll follow up and submit a ticket to that project.
On reading the release notes, the call interface changed in 3.x. I'll look to see what changes are necessary in pyparsing for this updated version.