railroad_dsl 0.1.0

A small DSL to generate syntax-diagrams
railroad_dsl-0.1.0 doesn't have any documentation.

A small DSL to generate syntax diagrams using this library.

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