You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most syntax diagrams run long horizontally but not vertically. It's also true - and related - that most syntax diagrams are made up from long Sequences but few Choices (which in turn have long Sequences). An example are the bitflags()- and named-attrs-macros.
It would be very useful to have a AutoStack which acts like a Sequence, yet has a desired aspect ratio (think 16:9). If the resulting geometry runs too long horizontally, it overflows elements into a Stack until the desired aspect ratio is reached or no actions are possible. An example of a Stack is "06_create-virtual-table-stmt_diagram.txt", where a long-running Sequence (manually) overflows into a Stack of three lanes.
To avoid overflowing just one element into the most bottom lane (where the bottom lane is mostly just one element and a long connector), the algorithm probably looks something like:
Our input is the same as Sequence
Init Y to 1
As long as our Stack is wider than the threshold
Increment Y
Divide the input into Y parts of equal width and those as lanes in our Stack
It's Ok if the resulting AutoStack-struct is immutable, that is, we don't allow modifcation where we have to re-compute everything.
Most syntax diagrams run long horizontally but not vertically. It's also true - and related - that most syntax diagrams are made up from long
Sequences
but fewChoices
(which in turn have longSequences
). An example are thebitflags()
- andnamed-attrs
-macros.It would be very useful to have a
AutoStack
which acts like aSequence
, yet has a desired aspect ratio (think 16:9). If the resulting geometry runs too long horizontally, it overflows elements into aStack
until the desired aspect ratio is reached or no actions are possible. An example of aStack
is "06_create-virtual-table-stmt_diagram.txt", where a long-runningSequence
(manually) overflows into aStack
of three lanes.To avoid overflowing just one element into the most bottom lane (where the bottom lane is mostly just one element and a long connector), the algorithm probably looks something like:
Sequence
Y
to 1Stack
is wider than the thresholdY
Y
parts of equal width and those as lanes in ourStack
It's Ok if the resulting
AutoStack
-struct is immutable, that is, we don't allow modifcation where we have to re-compute everything.We'd then simply switch
Sequence
toAutoStack
inmacro_railroad
's diagram generator.The text was updated successfully, but these errors were encountered: