parcon.railroad | index /home/jcp/github/parcon/parcon/railroad/__init__.py |
This module provides various classes for specifying what a particular syntax
diagram (a.k.a. railroad diagram) should look like.
The actual drawing of diagrams created with classes in this module is left up
to other modules included with Parcon in order to allow railroad diagrams that
look different to be created. The main one of these is the submodule raildraw,
which is a from-scratch railroad diagram drawing engine that can take a
railroad diagram as specified by classes in this module and convert it to a PNG
image.
Here's a really simple example that uses raildraw to draw a syntax diagram:
from parcon import First
# Create a parser to draw
some_parser = "Hello, " + First("world", "all you people")
# Then draw a diagram of it.
some_parser.draw_railroad_to_png({}, "test.png")
Package Contents | ||||||
|
Classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Functions | ||
|
Data | ||
ANYCASE = 3 DESCRIPTION = 4 PRODUCTION = 1 TEXT = 2 |