sfepy.base.parse_conf module

Create pyparsing grammar for problem configuration and options.

sfepy.base.parse_conf.create_bnf(allow_tuple=False, free_word=False)[source]
sfepy.base.parse_conf.cvt_array_index(toks)
sfepy.base.parse_conf.cvt_cmplx(toks)
sfepy.base.parse_conf.cvt_int(toks)
sfepy.base.parse_conf.cvt_none(toks)
sfepy.base.parse_conf.cvt_real(toks)
sfepy.base.parse_conf.get_standard_type_defs(word={W:(*+--9@-Z_a-z) [{{Suppress:('{') Forward: None} Suppress:('}')} Forward: None]})[source]

Return dict of the pyparsing base lexical elements.

The compound types (tuple, list, dict) can contain compound types or simple types such as integers, floats and words.

Parameters:
wordlexical element

A custom lexical element for word.

Returns:
defsdict

The dictionary with the following items:

  • tuple: (…, …, …)

  • list: […, …., …]

  • dict: {…:…, …:…, ….} or {…=…, …=…, ….}

  • list_item: any of preceding compound types or simple types

sfepy.base.parse_conf.list_dict(word={W:(*+--9@-Z_a-z) [{{Suppress:('{') Forward: None} Suppress:('}')} Forward: None]})[source]

Return the pyparsing lexical element, that parses a string either as a list or as a dictionary.

Parameters:
wordlexical element

A custom lexical element for word.

Returns:
ldlexical element

The returned lexical element parses a string in the form ..., ..., ... or key1:..., key2=..., key3: ... where ... is a list_item from get_standard_type_defs() and interprets it as a list or a dictionary.

sfepy.base.parse_conf.list_of(element, *elements)[source]

Return lexical element that parses a list of items. The items can be a one or several lexical elements. For example, result of list_of(real, integer) parses list of real or integer numbers.