Exit Policy on ill-defined elements in parser

Issue #71 resolved
Laurie Nevay created an issue

The parser currently does not exit on the following line:

hk1: hkicker, l=0.2*m, outerDiameter=0.4*m;

"hkicker" is wrong syntax and it should be "hkick". The parser instead, skips the item and it is omitted from the line as it's not already defined when sequence matching. As this proceeds without error, this can be quite hard to spot and cause a mismatch of optical functions (mostly due to lack of length).

I propose the parser should exit for ill-defined types.

Current example output:

main> Using input file : sm.gmad
type hkicker has not been defined
Warning : Expanding line l1 : element hk1 has not been defined , skipping

Jochem, I've assigned to you as from looking at the parser source code, I remember you introducing several levels of strictness / possible action by the parser. Perhaps it's fairly easy to upgrade this 'offence' to an 'exitable' one.

Comments (2)

  1. Jochem Snuverink

    Thanks for bringing this up. Some time ago I have created a variable, called PEDANTIC, that does exit on this. Currently it is switched off by default, but if you agree we can change that.

    I believe the original reason for not exiting on unknown keywords that a requirement was to read in madx syntax without errors, and that MadX has some keywords that don't do much and that are not used in BDSIM, and therefore they were ignored

    But I think it is better to pass such MadX keywords explicitly in the GMAD language.

  2. Log in to comment