McStasMcXtrace / mccode-antlr

McCode grammar implemented with ANTLR4
1 stars 0 forks source link

Inconsistencies in generated C code #61

Closed g5t closed 2 months ago

g5t commented 2 months ago

The C code generator refuses to accept %{ or }% tokens on a line with other tokens in some instances. It may not always be safe, e.g., with METADATA to add line breaks but may be necessary for interoperability with mainline McCode.

Instrument parameters used in setting component positions and orientations are not preceded by _instrument_var._parameters. which causes compilation to fail.

g5t commented 2 months ago

The second issue only appears for 'assembled' instruments, not those parsed from the McCode Instr syntax.

g5t commented 2 months ago

Because no check was performed to match-up position or orientation setting parameters with instrument runtime-defined parameters.

A more-strict check that forbids non-instrument identifiers would be nice, but would likely also require checking for initialize/declare defined identifiers (or forbid their use in positioning components, which doesn't seem good).