idaholab / MontePy

MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
29 stars 6 forks source link

Support poorly formatted Material definitions #182

Open MicahGale opened 1 year ago

MicahGale commented 1 year ago

LANL apparently doesn't know how to write a syntax specification. From LA-UR-17-29981 Section 3.3.2.1 a material specification shall take the form:

Mm zaid1 fraction1 zaid2 fraction2 ... [KEYWORD=value(s) ...]

Which makes sense.

Until you notice

Input Parameter Description
Keyword * Value

And finally notice the asterisk:

* M card keywords may appear anywhere among the zaid-fraction pairs, but must not separate a pair.

Yep The syntax specification from before is a lie. The key-value pairs can appear anywhere they like!

Why did the developers do this? I don't know.

Is this a context-free grammar? Probably not.

However, it is officially (in the worst documented ways possible) supported, so it needs to be supported in MOntePy.

MicahGale commented 7 months ago

I am leaning towards possibly just raising UnsupportedFeature and just moving on.