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"
def p_set_routes_create(p): 'Exp : ID COLON SETROUTES LP URL EQUAL STRING RP COLON CREATEDATA LP OBJECT EQUAL ID RP SEMICOLON' if (p[1] not in code.variables): p[0] = cl.id_not_defined(p[1]) elif p[14] not in code.variables: p[0] = cl.id_not_defined(p[14]) else: p[0] = code.create_data(code.add_route(p[1], cl.string_cleaner(p[7])), p[14])
def p_set_routes_read(p): 'Exp : ID COLON SETROUTES LP URL EQUAL STRING RP COLON READDATA LP BODY EQUAL ID RP SEMICOLON' if p[1] not in code.variables: p[0] = clean.id_not_defined(p[1]) elif p[14] not in code.variables: p[0] = clean.id_not_defined(p[14]) else: p[0] = code.read_data(code.add_route(p[1], clean.string_cleaner(p[7])), p[14])
def p_communicate(p): 'Exp : HTTPGET LP URL EQUAL STRING RP SEMICOLON' p[0] = code.http_get(clean.string_cleaner(p[5]))
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])
def p_set_routes_non_id(p): # returns name of added route id 'Exp : ID COLON SETROUTES LP URL EQUAL STRING RP SEMICOLON' if p[1] not in code.variables: p[0] = clean.id_not_defined(p[1]) else: p[0] = code.add_route(p[1], clean.string_cleaner(p[7]))