Flatten and Validate read nodes through one walk, and the parser, flattener,
validator and writer set variables through one type.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Count variable expansions against MaxBytes and stop substituting past it, so
nested #defines can't grow exponentially. Read at most MaxBytes from a reader.
- Lex in linear time: end an opcode value at the next line break with the same
regexp, and merge text nodes by slicing. Cap variable names at 128 bytes.
- Read a byte order mark as space so a directive after it is recognised.
- Refuse in WriteFiles an include path that is absolute or leaves the folder, and
report include.outside and sample.outside from Validate.
- Give a lone sw_lokey or sw_hikey a one-key range.
- Sum controller modulations in a fixed order so Instrument is deterministic.
- Stop samplePrefix looping on a sample at the root.
- Validate without lexing plain opcodes again, and cache registry lookups.
- Add regression tests and FuzzWrite, FuzzEdit and FuzzBuild.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Header.Get, Set and Delete edit opcodes in place and keep the text around
them. Write and WriteFiles take WriteOptions to inline includes, expand
variables and set line endings. Build makes a document from a typed
Instrument, with options to split regions into included files and to
hoist repeated values into #define directives.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>