def p_fieldvalue_nonuniform(self, p): '''fieldvalue : NONUNIFORM NAME list | NONUNIFORM prelist | NONUNIFORM NAME prelist''' if len(p) == 4: p[0] = Field(p[3], name=p[2]) else: p[0] = Field(p[2])
def p_dictitem(self, p): '''dictitem : longitem | pitem''' if type(p[1]) == tuple: if len(p[1]) == 2 and p[1][0] == "uniform": p[0] = Field(p[1][1]) elif len(p[1]) == 3 and p[1][0] == "nonuniform": p[0] = Field(p[1][2], name=p[1][1]) else: p[0] = TupleProxy(p[1]) else: p[0] = p[1]
def p_fieldvalue_nonuniform(self, p): '''fieldvalue : NONUNIFORM NAME list | NONUNIFORM prelist | NONUNIFORM NAME prelist''' if len(p) == 4: if isinstance(p[3], (NotAPrelist, )): p[0] = Field(p[3].b, name=p[2]) else: p[0] = Field(p[3], name=p[2]) else: if isinstance(p[2], (NotAPrelist, )): p[0] = Field(p[2].b) else: p[0] = Field(p[2])
def p_uniformfield(self, p): ''' uniformfield : integer '{' number '}' | integer '{' vector '}' | integer '{' tensor '}' | integer '{' symmtensor '}' ''' p[0] = Field(p[3], length=p[1])
def p_fieldvalue_uniform(self, p): '''fieldvalue : UNIFORM number | UNIFORM vector | UNIFORM tensor | UNIFORM symmtensor''' p[0] = Field(p[2])