Skip to content

Commit

Permalink
Fixed material parser to be able to parse plib=84p.
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahGale committed Sep 9, 2024
1 parent 020aeea commit 1d45c9c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions montepy/input_parser/material_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class MaterialParser(DataParser):
@_(
"introduction isotopes",
"introduction isotopes parameters",
"introduction isotopes mat_parameters",
)
def material(self, p):
ret = {}
Expand Down Expand Up @@ -47,3 +48,45 @@ def batch_gen():
for group in batch_gen():
new_list.append(("foo", *group))
return new_list

@_(
"mat_parameter",
"parameter",
"mat_parameters mat_parameter",
"mat_parameters parameter",
)
def mat_parameters(self, p):
"""
A list of the parameters (key, value pairs) for this input.
:returns: all parameters
:rtype: ParametersNode
"""
if len(p) == 1:
params = syntax_node.ParametersNode()
param = p[0]
else:
params = p[0]
param = p[1]
params.append(param)
return params

@_(
"classifier param_seperator library",
)
def mat_parameter(self, p):
"""
A singular Key-value pair.
:returns: the parameter.
:rtype: SyntaxNode
"""
return syntax_node.SyntaxNode(
p.classifier.prefix.value,
{"classifier": p.classifier, "seperator": p.param_seperator, "data": p[2]},
)

@_("NUMBER_WORD")
@_("NUMBER_WORD padding")
def library(self, p):
return self._flush_phrase(p, str)

0 comments on commit 1d45c9c

Please sign in to comment.