5 releases

0.2.0 Jun 17, 2023
0.1.3 Apr 29, 2023
0.1.2 Jan 19, 2019
0.1.1 Oct 25, 2018
0.1.0 Oct 24, 2018

#154 in Visualization

Download history 6/week @ 2024-02-21 10/week @ 2024-02-28 2/week @ 2024-03-06 2/week @ 2024-03-13 2/week @ 2024-03-27 6/week @ 2024-04-03

166 downloads per month

MIT license

12KB
225 lines

A small DSL to generate syntax diagrams using this library.

Crates.io Version Build status

Some examples

  • {...} is a horizontal stack of connected elements
  • [...] is a vertical sequence of connected elements
  • <...> is a choice of multiple options, exactly one of which has to be picked
  • "foobar" is a terminal
  • 'foobar' is a non-terminal
  • `foobar` is a comment
  • ...? is an optional element
  • ...*... is a repeated element
  • ! is the empty element

Quotes (and backslashes) can be escaped using backslashes.

For example:

{["CONSTRAINT" "name"]?,
 <["PRIMARY" "KEY" <!, "ASC", "DESC"> 'conflict-clause' <!, "AUTOINCREMENT">],
  ["NOT" "NULL" 'conflict-clause'],
  ["UNIQUE" 'conflict-clause'],
  ["CHECK" "(" 'expr' ")"],
  ["DEFAULT" <'signed-number', 'literal-value', ["(" 'expr' ")"]>],
  ["COLLATE" "collation-name"],
  'foreign-key-clause'>}

diagram for constraint syntax

Dependencies

~4.5MB
~77K SLoC