Ejemplo n.º 1
0
def p_lim(t):
    'lim : LIMIT INT'
    t[0] = t[2]
    insertProduction(t.slice, len(t.slice))
Ejemplo n.º 2
0
def p_ifexists1(p):
    "ifexists   :   "
    p[0] = ""
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 3
0
def p_createtb(p):
    "createtb   :   CREATE TABLE id PARA coltb PARC inherits PTCOMA"
    p[0] = inst.createtb(p[3],p[5],p[7])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 4
0
def p_alterdb3(p):
    "alterdb3   :   RENAME TO valortipo"
    p[0] = inst.alterdb3(p[3])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 5
0
def p_dropdb(p):
    "dropdb :   DROP DATABASE ifexists id PTCOMA"
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 6
0
def p_showdb(p):
    "showdb :   SHOW DATABASES PTCOMA"
    p[0] = inst.showdb(p[1])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 7
0
def p_alterdb2(p):
    "alterdb2   :   id alterdb3"
    p[0] = inst.alterdb2(p[1],p[2])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 8
0
def p_ddlmath(p):
    '''
    ddlmath : ABS PARA  valornume PARC
		| CBRT PARA  valornume PARC
		| CEIL PARA  valornume PARC
		| CEILING PARA valornume PARC
		| DEGREES PARA  valornume PARC
		| DIV PARA valornume COMA valornume PARC	
		| EXP PARA valornume PARC	
		| FACTORIAL PARA  valornume PARC
		| FLOOR PARA  valornume PARC
		| GCD PARA  valornume COMA valornume PARC
		| LCM PARA  valornume COMA valornume PARC
		| LN PARA  valornume PARC
		| LOG PARA  valornume COMA valornume PARC
		| LOG10 PARA  valornume PARC
		| MIN_SCALE PARA valornume PARC
		| MOD PARA valornume COMA valornume PARC
		| PI PARA PARC
		| POWER PARA  valornume COMA valornume PARC
		| RADIANS PARA  valornume PARC
		| ROUND PARA  valornume PARC
		| SCALE PARA  valornume PARC
		| SIGN PARA  valornume PARC
		| SQRT PARA  valornume PARC
		| TRIM_SCALE PARA valornume PARC
		| TRUNC PARA  valornume PARC 
		| WIDTH_BUCKET PARA  valornume COMA valornume COMA valornume COMA valornume PARC
		| RANDOM PARA PARC
		| SETSEED PARA  valornume PARC    
    '''
    if p[1].lower() == 'abs' : p[0] =  inst.math_abs2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'cbrt' : p[0] =  inst.math_cbrt2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'ceil' : p[0] =  inst.math_ceil2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'ceiling' : p[0] =  inst.math_ceil2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'div' : p[0] =  inst.math_div2(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'exp' : p[0] =  inst.math_exp2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'factorial' : p[0] =  inst.math_factorial2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'floor' : p[0] =  inst.math_floor2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'gcd' : p[0] =  inst.math_gcd2(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'lcm' : p[0] =  inst.math_lcm2(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'ln' : p[0] =  inst.math_ln2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'log' : p[0] =  inst.math_log2(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'log10' : p[0] =  inst.math_log102(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'min_scale' : p[0] =  inst.math_min_scale2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'mod' : p[0] =  inst.math_mod2(p[3],p[5]);(p.slice, len(p.slice))
    elif p[1].lower() == 'pi' : p[0] =  inst.math_pi2();insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'power' : p[0] =  inst.math_power2(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'radians' : p[0] =  inst.math_radians2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'round' : p[0] =  inst.math_round2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'scale' : p[0] =  inst.math_scale2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'sign' : p[0] =  inst.math_sign2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'sqrt' : p[0] =  inst.math_sqrt2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'trim_scale' : p[0] =  inst.math_trim_scale2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'trunc' : p[0] =  inst.math_trunc2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'width_bucket' : p[0] =  inst.math_widthBucket2(p[3],p[5],p[7],p[9]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'random' : p[0] =  inst.math_random2();insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'setseed' : p[0] =  inst.math_setseed2(p[3]);insertProduction(p.slice, len(p.slice))
Ejemplo n.º 9
0
def p_ddltrig(p):
    """
    ddltrig :   ACOS PARA valornume PARC
		| ACOSD PARA valornume PARC
		| ASIN PARA valornume PARC
		| ASIND PARA valornume PARC
		| ATAN PARA valornume PARC
		| ATAND PARA valornume PARC
		| ATAN2 PARA valornume COMA valornume PARC
		| ATAN2D PARA valornume COMA valornume PARC
		| COS PARA valornume PARC
		| COSD PARA valornume PARC
		| COT PARA valornume PARC
		| COTD PARA valornume PARC
		| SIN PARA valornume PARC
		| SIND PARA valornume PARC
		| TAN PARA valornume PARC
		| TAND PARA valornume PARC
		| SINH PARA valornume PARC
		| COSH PARA valornume PARC 
		| TANH PARA valornume PARC
		| ASINH PARA valornume PARC
		| ACOSH PARA valornume PARC
		| ATANH PARA valornume PARC
    """
    if p[1].lower() == 'acos' : p[0] =  inst.trig_acos2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'acosd' : p[0] =  inst.trig_acosd2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'asin' : p[0] =  inst.trig_asin2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'asind' : p[0] =  inst.trig_asind2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'atan' : p[0] =  inst.trig_atan2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'atand' : p[0] =  inst.trig_atand2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'atan2' : p[0] =  inst.trig_atan22(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'atan2d' : p[0] =  inst.trig_atan2d2(p[3],p[5]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'cos' : p[0] =  inst.trig_cos2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'cosd' : p[0] =  inst.trig_cosd2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'cot' : p[0] =  inst.trig_cot2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'cotd' : p[0] =  inst.trig_cotd2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'sin' : p[0] =  inst.trig_sin2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'sind' : p[0] =  inst.trig_sind2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'tan' : p[0] =  inst.trig_tan2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'tand' : p[0] =  inst.trig_tand2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'sinh' : p[0] =  inst.trig_sinh2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'cosh' : p[0] =  inst.trig_cosh2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'tanh' : p[0] =  inst.trig_tanh2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'asinh' : p[0] =  inst.trig_asinh2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'acosh' : p[0] =  inst.trig_acosh2(p[3]);insertProduction(p.slice, len(p.slice))
    elif p[1].lower() == 'atanh' : p[0] =  inst.trig_atanh2(p[3]);insertProduction(p.slice, len(p.slice))
Ejemplo n.º 10
0
def p_inicio2(p):
    """
    inicio  :   inst
    """
    p[0] = [p[1]]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 11
0
def p_id(p):
    "id : ID"
    p[0] = p[1]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 12
0
def p_offsetEmpty(t):
    'off : empty'
    t[0] = 0
    insertProduction(t.slice, len(t.slice))
Ejemplo n.º 13
0
def p_offset(t):
    'off : OFFSET INT'
    t[0] = t[2]
    insertProduction(t.slice, len(t.slice))
Ejemplo n.º 14
0
def p_limit(t):
    'lim : empty'
    t[0] = 0
    insertProduction(t.slice, len(t.slice))
Ejemplo n.º 15
0
def p_mode(p):
    "mode   :   MODE IGUAL valortipo"
    p[0] = p[3]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 16
0
def p_ddlfunc(p):
    """
    ddlfunc :     LENGTH PARA TEXTO PARC
                | SUBSTRING PARA TEXTO COMA TEXTO COMA TEXTO PARC
                | TRIM PARA TEXTO PARC
                | MD5 PARA TEXTO PARC
                | SHA256 PARA TEXTO PARC
                | SUBSTR PARA TEXTO COMA TEXTO COMA TEXTO PARC
                | CONVERT PARA TEXTO AS type PARC
                | GREATEST PARA listparaddlfunc PARC
                | LEAST PARA listparaddlfunc PARC
                | NOW PARA PARC

    """
    if p[1].lower() == 'length' : p[0] = inst.fun_length2(p[3]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'substring' : p[0] = inst.fun_substr2(p[3],p[5],p[7]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'trim' : p[0] = inst.fun_trim2(p[3]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'md5' : p[0] = inst.fun_md52(p[3]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'sha256' : p[0] = inst.fun_sha2562(p[3]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'substr' : p[0] = inst.fun_substr2(p[3],p[5],p[7]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'greatest' : p[0] = inst.fun_greatest2(p[3]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'least' : p[0] = inst.fun_least2(p[3]);insertProduction(p.slice, len(p.slice))
    if p[1].lower() == 'now' : p[0] = inst.fun_now2(p[1]);insertProduction(p.slice, len(p.slice))
Ejemplo n.º 17
0
def p_mode1(p):
    "mode   :   "
    p[0] = ""
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 18
0
def p_wherecond(p):
    "wherecond  :  id BETWEEN valortipo AND valortipo"
    p[0] = inst.wherecond(p[1],p[3],p[5])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 19
0
def p_alterdb(p):
    "alterdb    :   ALTER DATABASE alterdb2 PTCOMA"
    p[0] = inst.alterdb(p[3])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 20
0
def p_createdb(p):
    "createdb   :   CREATE replacedb DATABASE ifnotexists id owner mode PTCOMA"
    p[0] = inst.createdb(p[2],p[4],p[5],p[6],p[7])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 21
0
def p_alterdb21(p):
    "alterdb2    :   NAME OWNER TO valortipo"
    p[0] = inst.alterdb21(p[4])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 22
0
def p_replacedb(p):
    "replacedb  :   OR REPLACE"
    p[0] = p[1]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 23
0
def p_alterdb31(p):
    "alterdb3   :   OWNER TO LLAVEA valortipo SIMBOLOOR valortipo SIMBOLOOR valortipo LLAVEC"
    p[0] = inst.alterdb31(p[4],p[6],p[8])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 24
0
def p_replacedb1(p):
    "replacedb  :   "
    p[0] = ""
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 25
0
def p_ifexists(p):
    "ifexists   :   IF EXISTS"
    p[0] = p[1]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 26
0
def p_owner(p):
    "owner :   OWNER IGUAL valortipo"
    p[0] = p[1]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 27
0
def p_usedb(p):
    "usedb  :   USE id PTCOMA"
    p[0] = inst.usedb(p[2])
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 28
0
def p_owner1(p):
    "owner  :   "
    p[0] = ""
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 29
0
def p_inherits(p):
    "inherits   :   INHERITS PARA id PARC"
    p[0] = p[3]
    insertProduction(p.slice, len(p.slice))
Ejemplo n.º 30
0
def p_orderbyEmpty(t):
    'order : empty'
    t[0] = None
    insertProduction(t.slice, len(t.slice))