def _lift_method_scalar_parameter(location, *args): if len(args) == 2: # Default the direction to 'in' if not specified. direction = 'in' type, id = args else: assert len(args) == 3 direction, type, id = args if isinstance(type, Reference): if len(type.name) != 1: raise ParseError("type: \"%s\" is not a valid type" % type.name, location) type = normalise_type(type.name[0]) return Parameter(id, direction, type, location=location)
def p_parameter(t): '''parameter : direction type ID | direction type ID LSQUARE RSQUARE | direction ID ID | direction ID ID LSQUARE RSQUARE''' array = len(t) == 6 if isinstance(t[2], Type): t[0] = Parameter(t[3], t[1], t[2], array) else: t[0] = Parameter(t[3], t[1], Reference(t[2], Type, \ filename=t.lexer.filename, lineno=t.lexer.lineno), array) t[0].filename = t.lexer.filename t[0].lineno = t.lexer.lineno
def _lift_method_array_parameter(location, scalar_parameter): return Parameter(scalar_parameter.name, scalar_parameter.direction, scalar_parameter.type, True, location)