Repository navigation
Write component definitions that read back as written (#391) - #396
Merged
Merged
Conversation
`mccode-antlr extract` reconstitutes components with Comp.to_string, which wrote text the parser rejected or read differently: - DEPENDENCY came straight after DEFINE COMPONENT, but the grammar wants it after the parameters and metadata, so any component with one failed to parse (22 of the McStas components). - NOACC was never written. - `vector`, `double *` and `int *` parameters lost their type and default, initializer lists their braces; an archaic `symbol` came back as a string with an unquoted default. - Every block, and every METADATA, gained a blank line each time it was written and read, in instruments and instances (EXTEND) too, since they share the text wrapper. Every McStas and McXtrace component the reader accepts now reads back with the same parameters, metadata, flags and blocks, and writes identically a second time. Classic mcstas translates extracted bundles to the same C, apart from number formatting and a string default of 0 kept as NULL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mccode-antlr extractreconstitutes components with Comp.to_string, which wrote text the parser rejected or read differently:vector,double *andint *parameters lost their type and default, initializer lists their braces; an archaicsymbolcame back as a string with an unquoted default.Every McStas and McXtrace component the reader accepts now reads back with the same parameters, metadata, flags and blocks, and writes identically a second time. Classic mcstas translates extracted bundles to the same C, apart from number formatting and a string default of 0 kept as NULL.
Fixes #391