@@ -82,12 +82,6 @@ def COMMENT(element, t):
8282 ).strip ()
8383
8484
85- def ERROR (element , t ):
86- return '\n ' .join (
87- f'{ T (t )} McnpError: { attribute .error } .' for attribute in element .attributes
88- ).strip ()
89-
90-
9185def ASSIGN (element , t ):
9286 o = ''
9387
@@ -105,7 +99,7 @@ def ASSIGN(element, t):
10599 ).strip ()
106100
107101
108- def CHECK (element , t ):
102+ def CHECK (element , t , error ):
109103 o = ''
110104
111105 for attribute in element .attributes :
@@ -120,7 +114,7 @@ def CHECK(element, t):
120114 else :
121115 o += f'{ T (t )} if { attribute .name } is None:\n '
122116
123- o += f'{ T (t )} raise errors.McnpError (errors.McnpCode. { attribute . error } , { attribute .name } )\n '
117+ o += f'{ T (t )} raise errors.InpError (errors.InpCode. { error } , { attribute .name } )\n '
124118
125119 return o .strip ()
126120
@@ -275,10 +269,10 @@ def __init__(self, {LIST_NTO(option)}):
275269 ``{ C (name )} Option_{ C (option .name )} ``.
276270
277271 Raises:
278- { ERROR ( option , 3 ) }
272+ InpError: SEMANTICS_OPTION_VALUE.
279273 """
280274
281- { CHECK (option , 2 )}
275+ { CHECK (option , 2 , 'SEMANTICS_OPTION_VALUE' )}
282276
283277 self.value: typing.Final[tuple[any]] = types._Tuple([{ LIST_N_NSD (option )} ])
284278 { ASSIGN (option , 2 )}
@@ -295,14 +289,14 @@ def from_mcnp(source: str):
295289 ``{ C (name )} Option_{ C (option .name )} ``.
296290
297291 Raises:
298- McnpError : SYNTAX_{ U (name )} _OPTION.
292+ InpError : SYNTAX_{ U (name )} _OPTION.
299293 """
300294
301295 source, comments = _parser.preprocess_inp(source)
302296 tokens = { C (name )} Option_{ C (option .name )} ._REGEX.match(source)
303297
304298 if not tokens:
305- raise errors.McnpError (errors.McnpCode.SYNTAX_ { U ( name ) } _OPTION , source)
299+ raise errors.InpError (errors.InpCode.SYNTAX_OPTION , source)
306300
307301 { MATCH (option , 2 )}
308302
@@ -360,10 +354,10 @@ def __init__(self, {LIST_NTO(entry)}):
360354 ``{ C (name )} Entry{ C (entry .name )} ``.
361355
362356 Raises:
363- McnpError: SEMANTICS_DATA_ENTRY_VALUE .
357+ InpError: SEMANTICS_ENTRY_VALUE .
364358 """
365359
366- { CHECK (entry , 2 )}
360+ { CHECK (entry , 2 , 'SEMANTICS_ENTRY_VALUE' )}
367361
368362 self.parameters: typing.Final[tuple[any]] = types._Tuple([{ LIST_N (entry )} ])
369363 { ASSIGN (entry , 2 )}
@@ -380,14 +374,14 @@ def from_mcnp(source: str):
380374 ``{ C (name )} Entry_{ C (entry .name )} ``.
381375
382376 Raises:
383- McnpError : SYNTAX_{ U (name )} _ENTRY.
377+ InpError : SYNTAX_{ U (name )} _ENTRY.
384378 """
385379
386380 source, comments = _parser.preprocess_inp(source)
387381 tokens = { C (name )} Entry_{ C (entry .name )} ._REGEX.match(' ' + source)
388382
389383 if not tokens:
390- raise errors.McnpError (errors.McnpCode.SYNTAX_ { U ( name ) } _ENTRY , source)
384+ raise errors.InpError (errors.InpCode.SYNTAX_ENTRY , source)
391385
392386 { MATCH (entry , 2 )}
393387
0 commit comments