Esempio n. 1
0
def intern_cell_word(word: str):
    word = pu.ensure_upper(word)
    word, res = pu.internalize(word, CELL_WORDS)
    if not res:
        raise pu.ParseError(
            f"'{word}' is not a valid word for cell specification")
    return word
Esempio n. 2
0
 def option(self, p):
     text: str = p.OPTION
     if "=" in text:
         text = text.replace("=", " ", 1)
     option, value = text.split()
     option = cmn.ensure_upper(option)
     if option in ("GAS", "ESTEP", "COND"):
         value = int(value)
     return option, value
Esempio n. 3
0
def intern_surface_type(word: str):
    word = pu.ensure_upper(word)
    word, res = pu.internalize(word, SURFACE_TYPES)
    if not res:
        raise pu.ParseError(f"{word} is not a valid surface type")
    return word
Esempio n. 4
0
 def particle(self, p):
     result = pu.ensure_upper(p[0])
     return result