示例#1
0
def p_attr_list_null(p):
    "attr : attr_type_multi ID '=' NULL"
    (attr, nullable, _) = p[1]
    p[0] = DefineAttribute(attr,
                           p[2],
                           Literal(NoneValue()),
                           True,
                           nullable=nullable)
    attach_lnr(p, 3)
示例#2
0
def p_attr_undef(p):
    "attr : attr_type ID '=' UNDEF"
    (attr, nullable) = p[1]
    p[0] = DefineAttribute(attr,
                           p[2],
                           None,
                           remove_default=True,
                           nullable=nullable)
    attach_lnr(p, 2)
示例#3
0
def p_attr_list_dict(p: YaccProduction) -> None:
    "attr : DICT ID '=' map_def"
    p[0] = DefineAttribute(TypeDeclaration(p[1]), p[2], p[4])
    attach_from_string(p, 2)
示例#4
0
def p_attr_dict(p: YaccProduction) -> None:
    "attr : DICT ID"
    p[0] = DefineAttribute(TypeDeclaration(p[1]), p[2], None)
    attach_from_string(p, 2)
示例#5
0
def p_attr_undef(p: YaccProduction) -> None:
    "attr : attr_type ID '=' UNDEF"
    p[0] = DefineAttribute(p[1], p[2], None, remove_default=True)
    attach_from_string(p, 2)
示例#6
0
def p_attr_cte(p: YaccProduction) -> None:
    """attr : attr_type ID '=' constant
    | attr_type ID '=' constant_list"""
    p[0] = DefineAttribute(p[1], p[2], p[4])
    attach_from_string(p, 2)
示例#7
0
def p_attr(p: YaccProduction) -> None:
    "attr : attr_type ID"
    p[0] = DefineAttribute(p[1], p[2], None)
    attach_from_string(p, 2)
示例#8
0
def p_attr_list_dict_null(p):
    "attr : DICT '?'  ID '=' NULL"
    p[0] = DefineAttribute("dict", p[3], Literal(NoneValue()), nullable=True)
    attach_lnr(p, 1)
示例#9
0
def p_attr_cte(p):
    "attr : attr_type ID '=' constant"
    (attr, nullable) = p[1]
    p[0] = DefineAttribute(attr, p[2], p[4], nullable=nullable)
    attach_lnr(p, 2)
示例#10
0
def p_attr_dict_nullable(p):
    "attr : DICT '?' ID"
    p[0] = DefineAttribute("dict", p[3], None, nullable=True)
    attach_lnr(p, 1)
示例#11
0
def p_attr_list_dict(p):
    "attr : DICT ID '=' map_def"
    p[0] = DefineAttribute("dict", p[2], p[4])
    attach_lnr(p, 1)
示例#12
0
def p_attr_dict(p):
    "attr : DICT ID"
    p[0] = DefineAttribute("dict", p[2], None)
    attach_lnr(p, 1)
示例#13
0
def p_attr_list_cte(p):
    "attr : attr_type_multi ID '=' constant_list"
    (attr, nullable, _) = p[1]
    p[0] = DefineAttribute(attr, p[2], p[4], True, nullable=nullable)
    attach_lnr(p, 3)
示例#14
0
def p_attr_list(p):
    "attr : attr_type_multi ID"
    (attr, nullable, location) = p[1]
    p[0] = DefineAttribute(attr, p[2], None, True, nullable=nullable)
    p[0].location = location
    p[0].namespace = namespace
示例#15
0
def p_attr_list_dict_nullable(p: YaccProduction) -> None:
    "attr : DICT '?'  ID '=' map_def"
    p[0] = DefineAttribute(TypeDeclaration(p[1], nullable=True), p[3], p[5])
    attach_from_string(p, 3)
示例#16
0
def p_attr_list_dict_nullable(p):
    "attr : DICT '?'  ID '=' map_def"
    p[0] = DefineAttribute("dict", p[3], p[5], nullable=True)
    attach_lnr(p, 1)
示例#17
0
def p_attr_list_dict_null(p: YaccProduction) -> None:
    "attr : DICT '?'  ID '=' NULL"
    p[0] = DefineAttribute(TypeDeclaration(p[1], nullable=True), p[3],
                           make_none(p, 5))
    attach_from_string(p, 3)
示例#18
0
def p_attr(p):
    "attr : attr_type ID"
    (attr, nullable) = p[1]
    p[0] = DefineAttribute(attr, p[2], None, nullable=nullable)
    attach_lnr(p, 2)