Пример #1
0
def p_server_sets(p):
    'Exp : ID EQUAL ID COLON SETROUTES LP URL EQUAL STRING RP SEMICOLON'
    if p[3] not in code.variables:
        p[0] = clean.id_not_defined(p[3])
    else:
        code.add_route(p[3], clean.string_cleaner(p[9]), p[1])
        p[0] = clean.id_saved(p[1]) + "\nRoute added successfully"
Пример #2
0
def p_id_id(p):
    'Exp : ID EQUAL ID SEMICOLON'
    if p[3] not in code.variables:
        p[0] = clean.id_not_defined(p[3])
    else:
        code.update_variables(p[1], code.print_object(p[3]))
        p[0] = clean.id_saved(p[1])
Пример #3
0
def p_server_read_id(p):
    'Exp : ID EQUAL ID COLON READDATA LP BODY EQUAL ID RP SEMICOLON'
    if p[9] not in code.variables:
        p[0] = clean.id_not_defined(p[9])
    elif p[3] not in code.variables:
        p[0] = clean.id_not_defined(p[3])
    else:
        code.update_variables(p[1], code.read_data(p[3], p[9]))
        p[0] = clean.id_saved(p[1])
Пример #4
0
def p_server_creates_id(p):
    'Exp : ID EQUAL ID COLON CREATEDATA LP OBJECT EQUAL ID RP SEMICOLON'
    if p[9] not in code.variables:
        p[0] = clean.id_not_defined(p[9])
    elif p[3] not in code.variables:
        p[0] = clean.id_not_defined(p[3])
    else:
        code.update_variables(p[1], code.create_data(p[3], p[9]))
        p[0] = clean.id_saved(p[1])
Пример #5
0
def p_communicate_id(p):
    'Exp : ID EQUAL HTTPGET LP URL EQUAL STRING RP SEMICOLON'
    code.update_variables(p[1], code.http_get(clean.string_cleaner(p[7])))
    p[0] = clean.id_saved(p[1])
Пример #6
0
def p_object_def(p):
    'Exp : ID EQUAL JSON COLON LC Inside RC SEMICOLON'
    code.update_variables(p[1], "{" + p[6] + "}")
    p[0] = clean.id_saved(p[1])
Пример #7
0
def p_id_int(p):
    'Exp : ID EQUAL INT SEMICOLON'
    code.update_variables(p[1], p[3])
    p[0] = clean.id_saved(p[1])
Пример #8
0
def p_object_def_empty(p):
    'Exp : ID EQUAL JSON COLON LC RC SEMICOLON'
    code.update_variables(p[1], "{}")
    p[0] = clean.id_saved(p[1])