Open qwertie opened 5 years ago
Hmm, getting rid of NodeStyle
isn't that easy... it's not just LNode
that uses it, but also Token
, and Token
has a stronger case for actually needing it. It's sometimes convienient for a parser to copy the NodeStyle
over from the token unchanged; transforming it automatically is not trivial since NodeStyle
values are ambiguous (e.g. 6 is used for both TQStringLiteral and HexLiteral.)
Using
NodeStyle
(holds 8 bits of formatting info) has two genuine advantages:LNode
that is allowed to change. Eliminating it would preclude certain timesaving tricks that might come in handy in a compiler.Instead of
NodeStyle
we could use the flyweight pattern to store the styles as a normal attribute list.Attrs
property.EmptySourceFile
disjoint from whatever is being parsed, so if someone is hoping for an invariant where theRange
of a child is "within" theRange
of the parent will be disappointed. (Such disappointment already occurs when using macros.)Any thoughts @jonathanvdc?