lukaslueg / macro_railroad

A library to generate syntax diagrams for Rust macros.
MIT License
529 stars 11 forks source link

Keep Groups bounded? #14

Closed lukaslueg closed 5 years ago

lukaslueg commented 5 years ago
// We actually keep Groups as the parser sees them, representing them
// visually as boxed (literally "boxed", like a rectangle of pixels) sequence.
// This has two effects, both of which probably desireable:
//  * Groups are represented as a visually bound sequence of (nested) elements.
//  * The optimizer does not peek into a group but sees it as a whole.
//    This means we never tear apart a group while merging common tails.
//    While one might consider this correct-ish, it may prevent a *lot*
//    of folding if the macro is very large.
//  Maybe add a knob? Maybe this is superficial?
lukaslueg commented 5 years ago

jrust::java_inner really suffers from this; see #5

lukaslueg commented 5 years ago

There is now an Ungrouper-pass in e1110893518a79c5094417388475f2164fc9a194 so unpack groups if so desired. It should be applied before folding.