tabatkins / railroad-diagrams

:steam_locomotive: A small JS+SVG library for drawing railroad syntax diagrams, like on JSON.org. Now with a Python port!
MIT License
1.65k stars 152 forks source link

Allow to select single/double lines at start and end #18

Closed dswd closed 9 years ago

dswd commented 10 years ago

It would be great if you could select whether to have single or doulbe lines as the begin and end indicators. I am not completely sure but I think that the authors of json.org used this to highlight which of the non-terminals can have whitespace between the components.

tabatkins commented 10 years ago

Oh, huh. I never noticed that the JSON spec did that, and there's no indication anywhere in the spec that there's a convention attached to it. The rest of a railroad diagram is pretty self-explanatory.

I could certainly do this, but I think I'd prefer seeing if there's a reference anywhere else to this being a recognized practice in railroad diagrams.

What are you planning to use the distinction for?

jonathanKingston commented 9 years ago

I had always assumed the distinction was if the diagram didn't contain subtypes. So number and string don't contain anything but low level characters where as objects, arrays and values I would consider "composite types" where they are comprised of multiple other diagrams.

I would like this for the diagrams I have been building at: http://jetson.io

tabatkins commented 9 years ago

Hm, all right, that seems consistent. Yeah, I'm okay with this. I'll accept a PR if I don't get to it soon.

jonathanKingston commented 9 years ago

I wrote the code for the single lines the other day, just trying to think of the best way to hook that up to the diagram function, my two ideas were:

Just thought it was worth updating you, hopefully to save your time.

jonathanKingston commented 9 years ago

@tabatkins let me know what you think.