montepy.input_parser.cell_parser module

class montepy.input_parser.cell_parser.CellParser

Bases: MCNP_Parser

The parser for parsing a Cell input.

Added in version 0.2.0: This was added with the major parser rework.

Returns:

a syntax tree of the cell.

Return type:

SyntaxNode

cell(p)
classifier(p)

The classifier of a data input.

This represents the first word of the data input. E.g.: M4, IMP:N, F104:p

Return type:

ClassifierNode

classifier_phrase(p)

A classifier with its padding.

Return type:

ClassifierNode

data_prefix(p)
debugfile = None
equals_sign(p)

The seperation between a key and value for a parameter.

Returns:

a str ValueNode

Return type:

ValueNode

errok()

Clear the error status

error(token)

Default error handling.

Puts the data into a queue that can be pulled out later for one final clear debug.

Parameters:

token (Token) – the token that broke the parsing rules.

file_atom(p)
file_name(p)

A file name.

Return type:

str

file_phrase(p)

A file name with or without its padding.

Returns:

a str ValueNode.

Return type:

ValueNode

geometry_expr(p)
geometry_factor(p)
geometry_factory(p)
geometry_term(p)
identifier_phrase(p)

A non-zero number with or without padding converted to int.

Returns:

an int ValueNode

Return type:

ValueNode

index_position(value)
line_position(value)
log = <montepy.input_parser.parser_base.SLY_Supressor object>
material(p)
modifier(p)

A character that modifies a classifier, e.g., *TR.

Returns:

the modifier

Return type:

str

null_ident_phrase(p)

A zero number with or without its padding, for identification.

Returns:

an int ValueNode

Return type:

ValueNode

null_phrase(p)

A zero number with or without its padding.

Returns:

a float ValueNode

Return type:

ValueNode

number_phrase(p)

A non-zero number with or without padding.

Returns:

a float ValueNode

Return type:

ValueNode

number_sequence(p)

A list of numbers.

Return type:

ListNode

numerical_phrase(p)

Any number, including 0, with its padding.

Returns:

a float ValueNode

Return type:

ValueNode

padding(p)

Anything that is not semantically significant: white space, and comments.

Returns:

All sequential padding.

Return type:

PaddingNode

param_seperator(p)

The seperation between a key and value for a parameter.

Returns:

a str ValueNode

Return type:

ValueNode

parameter(p)

A singular Key-value pair.

Returns:

the parameter.

Return type:

SyntaxNode

parameters(p)

A list of the parameters (key, value pairs) for this input.

Returns:

all parameters

Return type:

ParametersNode

parse(token_generator, input=None)

Parses the token stream and returns a syntax tree.

If the parsing fails None will be returned. The error queue can be retrieved from parser.log.clear_queue().

Parameters:
  • token_generator (generator) – the token generator from lexer.tokenize.

  • input (Input) – the input that is being lexed and parsed.

Return type:

SyntaxNode

part(p)
particle_type(p)
precedence = (('left', 'SPACE'), ('left', 'TEXT'))
restart()

Clears internal state information about the current parse.

Should be ran before a new object is parsed.

shortcut_phrase(p)

A complete shortcut, which should be used, and not shortcut_sequence.

Returns:

the parsed shortcut.

Return type:

ShortcutNode

shortcut_sequence(p)

A shortcut (repeat, multiply, interpolate, or jump).

Returns:

the parsed shortcut.

Return type:

ShortcutNode

shortcut_start(p)
text_phrase(p)

A string with or without its padding.

Returns:

a str ValueNode.

Return type:

ValueNode

tokens = {'COMMENT', 'COMPLEMENT', 'DOLLAR_COMMENT', 'FILE_PATH', 'INTERPOLATE', 'JUMP', 'KEYWORD', 'LIBRARY_SUFFIX', 'LOG_INTERPOLATE', 'MESSAGE', 'MULTIPLY', 'NULL', 'NUMBER', 'NUMBER_WORD', 'NUM_INTERPOLATE', 'NUM_JUMP', 'NUM_LOG_INTERPOLATE', 'NUM_MULTIPLY', 'NUM_REPEAT', 'PARTICLE', 'PARTICLE_SPECIAL', 'REPEAT', 'SOURCE_COMMENT', 'SPACE', 'SURFACE_TYPE', 'TALLY_COMMENT', 'TEXT', 'THERMAL_LAW', 'ZAID'}
track_positions = True
union(p)