Browse Source

Sol Part 30: astyle -tSjp -A2 -k3 -W3 is Best Style!

master
Graham Northup 7 years ago
parent
commit
45891fa325
  1. 2
      ast.h
  2. 52
      astprint.c
  3. 146
      builtins.c
  4. 12
      cdata.c
  5. 56
      cdata.h
  6. 2026
      lex.yy.c
  7. 18
      object.c
  8. 136
      parser.tab.c
  9. 143
      parser.tab.h
  10. 14
      runtime.c
  11. 2
      sol.h
  12. 6
      solrun.c
  13. 6
      state.c
  14. 4
      util.c

2
ast.h

@ -135,7 +135,7 @@ typedef struct {
} iter_node;
typedef struct {
expr_node *ret;
expr_node *ret;
} ret_node;
typedef struct tag_stmtlist_node {

52
astprint.c

@ -28,27 +28,27 @@ void prst(sol_state_t *state, stmt_node *node, int lev) {
switch(node->type) {
case ST_EXPR:
prlev(state, lev, "Stmt<Expr>:");
prex(state, node->expr, lev+1);
prex(state, node->expr, lev + 1);
break;
case ST_IFELSE:
prlev(state, lev, "Stmt<IfElse>:");
lev++;
prlev(state, lev, "Cond:");
prex(state, node->ifelse->cond, lev+1);
prex(state, node->ifelse->cond, lev + 1);
prlev(state, lev, "IfTrue:");
prst(state, node->ifelse->iftrue, lev+1);
prst(state, node->ifelse->iftrue, lev + 1);
prlev(state, lev, "IfFalse:");
prst(state, node->ifelse->iffalse, lev+1);
prst(state, node->ifelse->iffalse, lev + 1);
break;
case ST_LOOP:
prlev(state, lev, "Stmt<Loop>:");
lev++;
prlev(state, lev, "Cond:");
prex(state, node->loop->cond, lev+1);
prex(state, node->loop->cond, lev + 1);
prlev(state, lev, "Loop:");
prst(state, node->loop->loop, lev+1);
prst(state, node->loop->loop, lev + 1);
break;
case ST_ITER:
@ -56,23 +56,23 @@ void prst(sol_state_t *state, stmt_node *node, int lev) {
lev++;
prlev(state, lev, "Var: %s", node->iter->var);
prlev(state, lev, "Iter:");
prex(state, node->iter->iter, lev+1);
prex(state, node->iter->iter, lev + 1);
prlev(state, lev, "Loop:");
prst(state, node->iter->loop, lev+1);
prst(state, node->iter->loop, lev + 1);
break;
case ST_LIST:
prlev(state, lev, "Stmt<List>:");
stmtlist_node *cur = node->stmtlist;
while(cur && cur->stmt) {
prst(state, cur->stmt, lev+1);
prst(state, cur->stmt, lev + 1);
cur = cur->next;
}
break;
case ST_RET:
prlev(state, lev, "Stmt<Ret>:");
prex(state, node->ret->ret, lev+1);
prex(state, node->ret->ret, lev + 1);
break;
case ST_CONT:
@ -120,7 +120,7 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
prlev(state, lev, "ListGen:");
cure = node->listgen->list;
while(cure && cure->expr) {
prex(state, cure->expr, lev+1);
prex(state, cure->expr, lev + 1);
cure = cure->next;
}
break;
@ -131,9 +131,9 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
cura = node->mapgen->map;
while(cura && cura->item) {
prlev(state, lev, "<Key>:");
prex(state, cura->item->key, lev+1);
prex(state, cura->item->key, lev + 1);
prlev(state, lev, "<Value>:");
prex(state, cura->item->value, lev+1);
prex(state, cura->item->value, lev + 1);
cura = cura->next;
}
break;
@ -215,9 +215,9 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
break;
}
prlev(state, lev, "Left:");
prex(state, node->binop->left, lev+1);
prex(state, node->binop->left, lev + 1);
prlev(state, lev, "Right:");
prex(state, node->binop->right, lev+1);
prex(state, node->binop->right, lev + 1);
break;
case EX_UNOP:
@ -241,27 +241,27 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
break;
}
prlev(state, lev, "Expr:");
prex(state, node->unop->expr, lev+1);
prex(state, node->unop->expr, lev + 1);
break;
case EX_INDEX:
prlev(state, lev, "Index:");
lev++;
prlev(state, lev, "Expr:");
prex(state, node->index->expr, lev+1);
prex(state, node->index->expr, lev + 1);
prlev(state, lev, "Index:");
prex(state, node->index->index, lev+1);
prex(state, node->index->index, lev + 1);
break;
case EX_SETINDEX:
prlev(state, lev, "SetIndex:");
lev++;
prlev(state, lev, "Expr:");
prex(state, node->setindex->expr, lev+1);
prex(state, node->setindex->expr, lev + 1);
prlev(state, lev, "Index:");
prex(state, node->setindex->index, lev+1);
prex(state, node->setindex->index, lev + 1);
prlev(state, lev, "Value:");
prex(state, node->setindex->value, lev+1);
prex(state, node->setindex->value, lev + 1);
break;
case EX_ASSIGN:
@ -269,7 +269,7 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
lev++;
prlev(state, lev, "Ident: %s", node->assign->ident);
prlev(state, lev, "Value:");
prex(state, node->assign->value, lev+1);
prex(state, node->assign->value, lev + 1);
break;
case EX_REF:
@ -280,11 +280,11 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
prlev(state, lev, "Call:");
lev++;
prlev(state, lev, "Expr:");
prex(state, node->call->expr, lev+1);
prex(state, node->call->expr, lev + 1);
prlev(state, lev, "Args:");
cure = node->call->args;
while(cure && cure->expr) {
prex(state, cure->expr, lev+1);
prex(state, cure->expr, lev + 1);
cure = cure->next;
}
break;
@ -296,11 +296,11 @@ void prex(sol_state_t *state, expr_node *node, int lev) {
prlev(state, lev, "Args:");
curi = node->funcdecl->args;
while(curi && curi->ident) {
prlev(state, lev+1, curi->ident);
prlev(state, lev + 1, curi->ident);
curi = curi->next;
}
prlev(state, lev, "Body:");
prst(state, node->funcdecl->body, lev+1);
prst(state, node->funcdecl->body, lev + 1);
break;
}
}

146
builtins.c

@ -31,7 +31,7 @@ sol_object_t *sol_f_not_impl(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_default_cmp(sol_state_t *state, sol_object_t *args) {
sol_object_t *a = sol_list_get_index(state, args, 0), *b = sol_list_get_index(state, args, 1);
sol_object_t *res = sol_new_int(state, a!=b);
sol_object_t *res = sol_new_int(state, a != b);
sol_obj_free(a);
sol_obj_free(b);
return res;
@ -121,7 +121,7 @@ sol_object_t *sol_f_type(sol_state_t *state, sol_object_t *args) {
return res;
}
static dsl_seq *seen=NULL;
static dsl_seq *seen = NULL;
int test_seen(sol_object_t *obj) {
dsl_seq_iter *iter;
@ -240,7 +240,7 @@ sol_object_t *sol_f_prepr(sol_state_t *state, sol_object_t *args) {
int i, sz = sol_list_len(state, args);
sol_object_t *obj, *str;
seen = dsl_seq_new_array(NULL, NULL);
for(i=0; i<sz; i++) {
for(i = 0; i < sz; i++) {
obj = sol_list_get_index(state, args, i);
str = sol_cast_repr(state, obj);
sol_printf(state, "%s", str->str);
@ -259,7 +259,7 @@ sol_object_t *sol_f_print(sol_state_t *state, sol_object_t *args) {
int i, sz = sol_list_len(state, args);
sol_object_t *obj, *str;
seen = dsl_seq_new_array(NULL, NULL);
for(i=0; i<sz; i++) {
for(i = 0; i < sz; i++) {
obj = sol_list_get_index(state, args, i);
str = sol_cast_string(state, obj);
sol_printf(state, "%s", str->str);
@ -303,7 +303,7 @@ sol_object_t *sol_f_rawset(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_range(sol_state_t *state, sol_object_t *args) {
sol_object_t *res = sol_new_list(state), *bound = sol_cast_int(state, sol_list_get_index(state, args, 0));
int i;
for(i=0; i<bound->ival; i++) {
for(i = 0; i < bound->ival; i++) {
sol_list_insert(state, res, sol_list_len(state, res), sol_new_int(state, i));
}
sol_obj_free(bound);
@ -354,13 +354,13 @@ sol_object_t *sol_f_execfile(sol_state_t *state, sol_object_t *args) {
fseek(f, 0, SEEK_END);
sz = ftell(f);
fseek(f, 0, SEEK_SET);
s = malloc(sz+1);
s = malloc(sz + 1);
if(!s) {
fclose(f);
return sol_set_error_string(state, "File memory allocation failure");
}
fread(s, 1, sz, f);
s[sz]=0;
s[sz] = 0;
fclose(f);
program = sol_compile(s);
@ -390,7 +390,7 @@ sol_object_t *sol_f_ord(sol_state_t *state, sol_object_t *args) {
sol_object_t *idx = sol_new_int(state, 0), *arg2, *iarg, *res;
size_t len = strlen(str->str);
sol_obj_free(arg);
if(sol_list_len(state, args)>1) {
if(sol_list_len(state, args) > 1) {
arg2 = sol_list_get_index(state, args, 1);
iarg = sol_cast_int(state, arg2);
sol_obj_free(arg2);
@ -410,7 +410,7 @@ sol_object_t *sol_f_ord(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_chr(sol_state_t *state, sol_object_t *args) {
sol_object_t *arg = sol_list_get_index(state, args, 0), *iarg = sol_cast_int(state, arg);
char cbuf[2]= {iarg->ival, 0};
char cbuf[2] = {iarg->ival, 0};
sol_object_t *res = sol_new_string(state, cbuf);
sol_obj_free(arg);
sol_obj_free(iarg);
@ -441,7 +441,7 @@ sol_object_t *sol_f_debug_closure(sol_state_t *state, sol_object_t *args) {
}
sol_object_t *sol_f_debug_globals(sol_state_t *state, sol_object_t *args) {
return sol_list_get_index(state, state->scopes, sol_list_len(state, state->scopes)-1);
return sol_list_get_index(state, state->scopes, sol_list_len(state, state->scopes) - 1);
}
sol_object_t *sol_f_debug_locals(sol_state_t *state, sol_object_t *args) {
@ -678,7 +678,7 @@ sol_object_t *sol_f_int_bnot(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_int_cmp(sol_state_t *state, sol_object_t *args) {
sol_object_t *a = sol_list_get_index(state, args, 0), *b = sol_cast_int(state, sol_list_get_index(state, args, 1));
sol_object_t *res = sol_new_int(state, a->ival==b->ival? 0 : (a->ival<b->ival? -1 : 1));
sol_object_t *res = sol_new_int(state, a->ival == b->ival ? 0 : (a->ival < b->ival ? -1 : 1));
sol_obj_free(a);
sol_obj_free(b);
return res;
@ -766,7 +766,7 @@ sol_object_t *sol_f_float_pow(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_float_cmp(sol_state_t *state, sol_object_t *args) {
sol_object_t *a = sol_list_get_index(state, args, 0), *b = sol_cast_float(state, sol_list_get_index(state, args, 1));
sol_object_t *res = sol_new_int(state, a->fval==b->fval? 0 : (a->fval<b->fval? -1 : 1));
sol_object_t *res = sol_new_int(state, a->fval == b->fval ? 0 : (a->fval < b->fval ? -1 : 1));
sol_obj_free(a);
sol_obj_free(b);
return res;
@ -809,7 +809,7 @@ sol_object_t *sol_f_str_mul(sol_state_t *state, sol_object_t *args) {
int n = strlen(a->str) * b->ival + 1;
char *s = malloc(n);
int i;
s[0]='\0';
s[0] = '\0';
for(i = 0; i < b->ival; i++) {
strncat(s, a->str, n);
}
@ -841,7 +841,7 @@ sol_object_t *sol_f_str_len(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_str_index(sol_state_t *state, sol_object_t *args) {
sol_object_t *str = sol_list_get_index(state, args, 0), *key = sol_list_get_index(state, args, 1), *idx, *funcs, *res;
char buf[2]= {0, 0};
char buf[2] = {0, 0};
if(sol_is_string(key)) {
funcs = sol_get_methods_name(state, "string");
res = sol_map_get(state, funcs, key);
@ -849,7 +849,7 @@ sol_object_t *sol_f_str_index(sol_state_t *state, sol_object_t *args) {
return res;
}
idx = sol_cast_int(state, key);
if(idx->ival>=0 && idx->ival<strlen(str->str)) {
if(idx->ival >= 0 && idx->ival < strlen(str->str)) {
buf[0] = str->str[idx->ival];
}
sol_obj_free(str);
@ -906,23 +906,23 @@ sol_object_t *sol_f_str_sub(sol_state_t *state, sol_object_t *args) {
}
sol_obj_free(low);
sol_obj_free(high);
if(ilow->ival<0) {
ilow->ival+=len;
if(ilow->ival<0) {
ilow->ival=0;
if(ilow->ival < 0) {
ilow->ival += len;
if(ilow->ival < 0) {
ilow->ival = 0;
}
}
if(ilow->ival>len) {
ilow->ival=len;
if(ilow->ival > len) {
ilow->ival = len;
}
if(ihigh->ival<0) {
ihigh->ival+=len;
if(ihigh->ival<0) {
ihigh->ival=0;
if(ihigh->ival < 0) {
ihigh->ival += len;
if(ihigh->ival < 0) {
ihigh->ival = 0;
}
}
if(ihigh->ival>len) {
ihigh->ival=len;
if(ihigh->ival > len) {
ihigh->ival = len;
}
if(ilow->ival >= ihigh->ival) {
sol_obj_free(ilow);
@ -931,10 +931,10 @@ sol_object_t *sol_f_str_sub(sol_state_t *state, sol_object_t *args) {
return sol_new_string(state, "");
}
s = malloc(ihigh->ival - ilow->ival + 1);
for(i=ilow->ival; i<ihigh->ival; i++) {
s[i-ilow->ival] = str->str[i];
for(i = ilow->ival; i < ihigh->ival; i++) {
s[i - ilow->ival] = str->str[i];
}
s[ihigh->ival-ilow->ival]='\0';
s[ihigh->ival - ilow->ival] = '\0';
sol_obj_free(ihigh);
sol_obj_free(ilow);
sol_obj_free(str);
@ -968,7 +968,7 @@ sol_object_t *sol_f_str_split(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_str_find(sol_state_t *state, sol_object_t *args) {
sol_object_t *str = sol_list_get_index(state, args, 0), *substr = sol_list_get_index(state, args, 1), *ssubstr = sol_cast_string(state, substr);
char *ptr = strstr(str->str, ssubstr->str);
sol_object_t *res = sol_new_int(state, ptr?ptr-str->str:-1);
sol_object_t *res = sol_new_int(state, ptr ? ptr - str->str : -1);
sol_obj_free(str);
sol_obj_free(substr);
sol_obj_free(ssubstr);
@ -1027,7 +1027,7 @@ sol_object_t *sol_f_list_index(sol_state_t *state, sol_object_t *args) {
}
sol_object_t *sol_f_list_setindex(sol_state_t *state, sol_object_t *args) {
sol_object_t *ls = sol_list_get_index(state, args, 0), *b = sol_cast_int(state, sol_list_get_index(state, args ,1));
sol_object_t *ls = sol_list_get_index(state, args, 0), *b = sol_cast_int(state, sol_list_get_index(state, args , 1));
sol_object_t *val = sol_list_get_index(state, args, 2);
sol_list_set_index(state, ls, b->ival, val);
sol_obj_free(ls);
@ -1107,9 +1107,9 @@ sol_object_t *sol_f_list_truncate(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_list_map(sol_state_t *state, sol_object_t *args) {
sol_object_t *list = sol_list_get_index(state, args, 0), *func = sol_list_get_index(state, args, 1);
sol_object_t *fargs = sol_new_list(state), *item;
int idx=0, len = sol_list_len(state, list);
int idx = 0, len = sol_list_len(state, list);
sol_list_insert(state, fargs, 0, func);
while(idx<len) {
while(idx < len) {
item = sol_list_get_index(state, list, idx);
sol_list_insert(state, fargs, 1, item);
sol_obj_free(item);
@ -1130,9 +1130,9 @@ sol_object_t *sol_f_list_map(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_list_filter(sol_state_t *state, sol_object_t *args) {
sol_object_t *list = sol_list_get_index(state, args, 0), *func = sol_list_get_index(state, args, 1);
sol_object_t *fargs = sol_new_list(state), *item, *ival;
int idx=0, len = sol_list_len(state, list);
int idx = 0, len = sol_list_len(state, list);
sol_list_insert(state, fargs, 0, func);
while(idx<len) {
while(idx < len) {
item = sol_list_get_index(state, list, idx);
sol_list_insert(state, fargs, 1, item);
sol_obj_free(item);
@ -1349,7 +1349,7 @@ sol_object_t *sol_f_mcell_tostring(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_func_index(sol_state_t *state, sol_object_t *args) {
sol_object_t *func = sol_list_get_index(state, args, 0), *key = sol_list_get_index(state, args, 1), *res;
identlist_node *curi;
int i=0;
int i = 0;
if(!sol_is_string(key)) {
res = sol_map_get(state, func->udata, key);
} else {
@ -1428,11 +1428,11 @@ sol_object_t *sol_f_cfunc_tostring(sol_state_t *state, sol_object_t *args) {
}
sol_object_t *sol_f_astnode_call(sol_state_t *state, sol_object_t *args) {
sol_object_t *obj = sol_list_get_index(state, args, 0), *env=NULL, *res;
sol_object_t *obj = sol_list_get_index(state, args, 0), *env = NULL, *res;
stmt_node *stmt = (stmt_node *) obj->node;
expr_node *expr = (expr_node *) obj->node;
sol_obj_free(obj);
if(sol_list_len(state, args)>1) {
if(sol_list_len(state, args) > 1) {
env = sol_list_get_index(state, args, 1);
sol_state_push_scope(state, env);
}
@ -1450,14 +1450,14 @@ sol_object_t *sol_f_astnode_call(sol_state_t *state, sol_object_t *args) {
}
sol_object_t *sol_f_astnode_index(sol_state_t *state, sol_object_t *args) {
sol_object_t *obj = sol_list_get_index(state, args, 0), *key = sol_list_get_index(state, args, 1), *str = sol_cast_string(state, key), *res=NULL, *pair;
sol_object_t *obj = sol_list_get_index(state, args, 0), *key = sol_list_get_index(state, args, 1), *str = sol_cast_string(state, key), *res = NULL, *pair;
stmt_node *stmt = (stmt_node *) obj->node;
stmtlist_node *curs;
expr_node *expr = (expr_node *) obj->node;
exprlist_node *cure;
assoclist_node *cura;
identlist_node *curi;
int i=0;
int i = 0;
if(sol_is_aststmt(obj)) {
if(sol_string_eq(state, str, "type")) {
res = sol_new_int(state, stmt->type);
@ -1630,7 +1630,7 @@ sol_object_t *sol_f_astnode_index(sol_state_t *state, sol_object_t *args) {
case EX_FUNCDECL:
if(sol_string_eq(state, str, "name")) {
res = sol_new_string(state, (expr->funcdecl->name?expr->funcdecl->name:""));
res = sol_new_string(state, (expr->funcdecl->name ? expr->funcdecl->name : ""));
} else if(sol_string_eq(state, str, "args")) {
res = sol_new_list(state);
curi = expr->funcdecl->args;
@ -1663,7 +1663,7 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
exprlist_node *cure, *preve = NULL;
assoclist_node *cura, *preva = NULL;
identlist_node *curi, *previ = NULL;
int i=0, len;
int i = 0, len;
if(sol_is_aststmt(obj)) {
if(sol_string_eq(state, str, "type")) {
ival = sol_cast_int(state, val);
@ -1721,10 +1721,10 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
case ST_LIST:
if(sol_string_eq(state, str, "stmtlist") && sol_is_list(val)) {
len = sol_list_len(state, val);
if(len>0) {
if(len > 0) {
curs = malloc(sizeof(stmtlist_node));
stmt->stmtlist = curs;
for(i=0; i<len; i++) {
for(i = 0; i < len; i++) {
if(sol_is_aststmt(sol_list_get_index(state, val, i))) {
curs->stmt = sol_list_get_index(state, val, i)->node;
prevs = curs;
@ -1793,10 +1793,10 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
case EX_LISTGEN:
if(sol_string_eq(state, str, "list") && sol_is_list(val)) {
len = sol_list_len(state, val);
if(len>0) {
if(len > 0) {
cure = malloc(sizeof(exprlist_node));
expr->listgen->list = cure;
for(i=0; i<len; i++) {
for(i = 0; i < len; i++) {
if(sol_is_astexpr(sol_list_get_index(state, val, i))) {
cure->expr = sol_list_get_index(state, val, i)->node;
preve = cure;
@ -1820,10 +1820,10 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
case EX_MAPGEN:
if(sol_string_eq(state, str, "map") && sol_is_list(val)) {
len = sol_list_len(state, val);
if(len>0) {
if(len > 0) {
cura = malloc(sizeof(assoclist_node));
expr->mapgen->map = cura;
for(i=0; i<len; i++) {
for(i = 0; i < len; i++) {
if(sol_is_list(sol_list_get_index(state, val, i))) {
pair = sol_list_get_index(state, val, i);
if(sol_list_len(state, pair) >= 2 && sol_is_astexpr(sol_list_get_index(state, pair, 0)) && sol_is_astexpr(sol_list_get_index(state, pair, 1))) {
@ -1912,10 +1912,10 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
expr->call->expr = val->node;
} else if(sol_string_eq(state, str, "args") && sol_is_list(val)) {
len = sol_list_len(state, val);
if(len>0) {
if(len > 0) {
cure = malloc(sizeof(exprlist_node));
expr->call->args= cure;
for(i=0; i<len; i++) {
expr->call->args = cure;
for(i = 0; i < len; i++) {
if(sol_is_astexpr(sol_list_get_index(state, val, i))) {
cure->expr = sol_list_get_index(state, val, i)->node;
preve = cure;
@ -1943,10 +1943,10 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
sol_obj_free(sval);
} else if(sol_string_eq(state, str, "args") && sol_is_list(val)) {
len = sol_list_len(state, val);
if(len>0) {
if(len > 0) {
curi = malloc(sizeof(identlist_node));
expr->funcdecl->args= curi;
for(i=0; i<len; i++) {
expr->funcdecl->args = curi;
for(i = 0; i < len; i++) {
sval = sol_cast_string(state, sol_list_get_index(state, val, i));
curi->ident = strdup(sval->str);
sol_obj_free(sval);
@ -1977,8 +1977,8 @@ sol_object_t *sol_f_astnode_setindex(sol_state_t *state, sol_object_t *args) {
return val;
}
static char *sol_StmtNames[]= {"EXPR", "IFSELSE", "LOOP", "ITER", "LIST", "RET", "CONT", "BREAK"};
static char *sol_ExprNames[]= {"LIT", "LISTGEN", "MAPGEN", "BINOP", "UNOP", "INDEX", "SETINDEX", "ASSIGN", "REF", "CALL", "FUNCDECL"};
static char *sol_StmtNames[] = {"EXPR", "IFSELSE", "LOOP", "ITER", "LIST", "RET", "CONT", "BREAK"};
static char *sol_ExprNames[] = {"LIT", "LISTGEN", "MAPGEN", "BINOP", "UNOP", "INDEX", "SETINDEX", "ASSIGN", "REF", "CALL", "FUNCDECL"};
sol_object_t *sol_f_astnode_tostring(sol_state_t *state, sol_object_t *args) {
sol_object_t *obj = sol_list_get_index(state, args, 0), *res;
@ -2027,9 +2027,9 @@ sol_object_t *sol_f_buffer_new(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_buffer_get(sol_state_t *state, sol_object_t *args) {
sol_object_t *buf = sol_list_get_index(state, args, 0), *tp = sol_list_get_index(state, args, 1), *off = sol_list_get_index(state, args, 2);
sol_object_t *itp = sol_cast_int(state, tp), *ioff, *res=NULL;
sol_object_t *itp = sol_cast_int(state, tp), *ioff, *res = NULL;
sol_buftype_t buftp = itp->ival;
char *data, cbuf[2]= {0, 0};
char *data, cbuf[2] = {0, 0};
sol_obj_free(tp);
sol_obj_free(itp);
if(!sol_is_none(state, off)) {
@ -2043,7 +2043,7 @@ sol_object_t *sol_f_buffer_get(sol_state_t *state, sol_object_t *args) {
sol_obj_free(ioff);
return sol_incref(state->None);
}
data = ((char *) buf->buffer)+ioff->ival;
data = ((char *) buf->buffer) + ioff->ival;
sol_obj_free(buf);
sol_obj_free(ioff);
switch(buftp) {
@ -2117,7 +2117,7 @@ sol_object_t *sol_f_buffer_get(sol_state_t *state, sol_object_t *args) {
break;
case BUF_PTR:
res = sol_new_buffer(state, ((void *) *((unsigned long *) data)), -1, OWN_NONE, NULL, NULL);
res = sol_new_buffer(state, ((void *) * ((unsigned long *) data)), -1, OWN_NONE, NULL, NULL);
break;
}
if(!res) {
@ -2128,7 +2128,7 @@ sol_object_t *sol_f_buffer_get(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_buffer_set(sol_state_t *state, sol_object_t *args) {
sol_object_t *buf = sol_list_get_index(state, args, 0), *tp = sol_list_get_index(state, args, 1), *val = sol_list_get_index(state, args, 2), *off = sol_list_get_index(state, args, 3);
sol_object_t *itp = sol_cast_int(state, tp), *ioff, *ival=NULL, *fval=NULL, *sval=NULL;
sol_object_t *itp = sol_cast_int(state, tp), *ioff, *ival = NULL, *fval = NULL, *sval = NULL;
sol_buftype_t buftp = itp->ival;
char *data;
sol_obj_free(tp);
@ -2144,7 +2144,7 @@ sol_object_t *sol_f_buffer_set(sol_state_t *state, sol_object_t *args) {
sol_obj_free(ioff);
return sol_incref(state->None);
}
data = ((char *) buf->buffer)+ioff->ival;
data = ((char *) buf->buffer) + ioff->ival;
sol_obj_free(buf);
sol_obj_free(ioff);
switch(buftp) {
@ -2273,7 +2273,7 @@ sol_object_t *sol_f_buffer_size(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_buffer_fromstring(sol_state_t *state, sol_object_t *args) {
sol_object_t *val = sol_list_get_index(state, args, 0), *sval = sol_cast_string(state, val);
size_t sz = strlen(sval->str)+1;
size_t sz = strlen(sval->str) + 1;
sol_object_t *buf = sol_new_buffer(state, malloc(sz), sz, OWN_FREE, NULL, NULL);
strcpy(buf->buffer, sval->str);
sol_obj_free(val);
@ -2366,8 +2366,8 @@ sol_object_t *sol_f_stream_write(sol_state_t *state, sol_object_t *args) {
sol_object_t *sol_f_stream_read(sol_state_t *state, sol_object_t *args) {
sol_object_t *stream = sol_list_get_index(state, args, 0), *amt = sol_list_get_index(state, args, 1), *iamt, *res;
char *s=NULL, *p;
size_t count=0, max=0, pos, end;
char *s = NULL, *p;
size_t count = 0, max = 0, pos, end;
if(sol_is_string(amt)) {
if(sol_string_eq(state, amt, "ALL")) {
pos = sol_stream_ftell(state, stream);
@ -2375,23 +2375,23 @@ sol_object_t *sol_f_stream_read(sol_state_t *state, sol_object_t *args) {
end = sol_stream_ftell(state, stream);
sol_stream_fseek(state, stream, pos, SEEK_SET);
//printf("IO: Reading %ld bytes starting at %ld\n", end-pos, pos);
s = malloc((end-pos+1)*sizeof(char));
if(sol_stream_fread(state, stream, s, sizeof(char), end-pos)<(end-pos)) {
s = malloc((end - pos + 1) * sizeof(char));
if(sol_stream_fread(state, stream, s, sizeof(char), end - pos) < (end - pos)) {
free(s);
sol_obj_free(stream);
sol_obj_free(amt);
return sol_set_error_string(state, "IO read error");
}
s[end-pos]='\0';
s[end - pos] = '\0';
} else if(sol_string_eq(state, amt, "LINE")) {
s = malloc(STDIO_CHUNK_SIZE*sizeof(char));
s = malloc(STDIO_CHUNK_SIZE * sizeof(char));
sol_stream_fgets(state, stream, s, STDIO_CHUNK_SIZE);
}
} else {
iamt = sol_cast_int(state, amt);
s = malloc((iamt->ival + 1)*sizeof(char));
s = malloc((iamt->ival + 1) * sizeof(char));
count = sol_stream_fread(state, stream, s, sizeof(char), iamt->ival);
s[count]='\0';
s[count] = '\0';
sol_obj_free(iamt);
}
if(s) {
@ -2437,7 +2437,7 @@ sol_object_t *sol_f_stream_eof(sol_state_t *state, sol_object_t *args) {
return res;
}
static char *sol_FileModes[]= {
static char *sol_FileModes[] = {
NULL,
"r",
"w",

12
cdata.c

@ -140,9 +140,9 @@ sol_object_t *sol_f_cstruct_index(sol_state_t *state, sol_object_t *args) {
res = sol_new_int(state, AT(cstruct->data, uint32_t, spec->offset));
break;
/*case SOL_MT_UINT64:
res = sol_new_int(state, AT(cstruct->data, uint64_t, spec->offset));
break;*/
/*case SOL_MT_UINT64:
res = sol_new_int(state, AT(cstruct->data, uint64_t, spec->offset));
break;*/
case SOL_MT_FLOAT:
res = sol_new_float(state, AT(cstruct->data, float, spec->offset));
@ -233,9 +233,9 @@ sol_object_t *sol_f_cstruct_setindex(sol_state_t *state, sol_object_t *args) {
AT(cstruct->data, uint32_t, spec->offset) = sol_cast_int(state, val)->ival;
break;
/*case SOL_MT_UINT64:
AT(cstruct->data, uint64_t, spec->offset) = sol_cast_int(state, val)->ival;
break;*/
/*case SOL_MT_UINT64:
AT(cstruct->data, uint64_t, spec->offset) = sol_cast_int(state, val)->ival;
break;*/
case SOL_MT_FLOAT:
AT(cstruct->data, float, spec->offset) = sol_cast_float(state, val)->fval;

56
cdata.h

@ -4,44 +4,44 @@
#include "sol.h"
typedef enum {
SOL_MT_INT,
SOL_MT_INT8,
SOL_MT_INT16,
SOL_MT_INT32,
SOL_MT_INT64,
SOL_MT_UINT,
SOL_MT_UINT8,
SOL_MT_UINT16,
SOL_MT_UINT32,
SOL_MT_INT,
SOL_MT_INT8,
SOL_MT_INT16,
SOL_MT_INT32,
SOL_MT_INT64,
SOL_MT_UINT,
SOL_MT_UINT8,
SOL_MT_UINT16,
SOL_MT_UINT32,
// SOL_MT_UINT64, TODO: Not yet supported
SOL_MT_FLOAT,
SOL_MT_DOUBLE,
SOL_MT_CHAR,
SOL_MT_CSTR,
SOL_MT_CFUNC,
SOL_MT_PTR // Don't use this in add_member--use add_pointer
SOL_MT_FLOAT,
SOL_MT_DOUBLE,
SOL_MT_CHAR,
SOL_MT_CSTR,
SOL_MT_CFUNC,
SOL_MT_PTR // Don't use this in add_member--use add_pointer
} sol_memtype_t;
typedef enum {
SOL_CS_MEMBER,
SOL_CS_CFUNC
SOL_CS_MEMBER,
SOL_CS_CFUNC
} sol_spec_t;
typedef struct {
sol_spec_t type;
union {
struct {
sol_memtype_t memtype;
int offset;
sol_object_t *specs;
};
sol_cfunc_t cfunc;
};
sol_spec_t type;
union {
struct {
sol_memtype_t memtype;
int offset;
sol_object_t *specs;
};
sol_cfunc_t cfunc;
};
} sol_memspec_t;
typedef struct {
void *data;
sol_object_t *specs;
void *data;
sol_object_t *specs;
} sol_cstruct_t;
sol_object_t *sol_new_cstruct_specs(sol_state_t *);

2026
lex.yy.c
File diff suppressed because it is too large
View File

18
object.c

@ -160,35 +160,35 @@ sol_object_t *sol_list_sublist(sol_state_t *state, sol_object_t *list, int idx)
return sol_set_error_string(state, "Create sublist at negative index");
}
subl = dsl_seq_copy(list->seq);
for(i=0; i<idx; i++) {
for(i = 0; i < idx; i++) {
dsl_seq_delete(subl, 0);
}
return sol_list_from_seq(state, subl);
}
sol_object_t *sol_list_get_index(sol_state_t *state, sol_object_t *list, int idx) {
if(idx<0 || idx>=dsl_seq_len(list->seq)) {
if(idx < 0 || idx >= dsl_seq_len(list->seq)) {
return sol_incref(state->None);
}
return sol_incref(AS_OBJ(dsl_seq_get(list->seq, idx)));
}
void sol_list_set_index(sol_state_t *state, sol_object_t *list, int idx, sol_object_t *obj) {
if(idx<0 || idx>=dsl_seq_len(list->seq)) {
if(idx < 0 || idx >= dsl_seq_len(list->seq)) {
return;
}
dsl_seq_set(list->seq, idx, obj);
}
void sol_list_insert(sol_state_t *state, sol_object_t *list, int idx, sol_object_t *obj) {
if(idx<0 || idx>dsl_seq_len(list->seq)) {
if(idx < 0 || idx > dsl_seq_len(list->seq)) {
return;
}
dsl_seq_insert(list->seq, idx, obj);
}
sol_object_t *sol_list_remove(sol_state_t *state, sol_object_t *list, int idx) {
if(idx<0 || idx>=dsl_seq_len(list->seq)) {
if(idx < 0 || idx >= dsl_seq_len(list->seq)) {
return sol_incref(state->None);
}
return dsl_seq_remove(list->seq, idx);
@ -204,8 +204,8 @@ sol_object_t *sol_list_truncate(sol_state_t *state, sol_object_t *list, int len)
int pos = dsl_seq_iter_seek(iter, len);
int sz = dsl_seq_len(newseq);
int i;
if(pos>=len) {
for(i=0; i<sz-pos; i++) {
if(pos >= len) {
for(i = 0; i < sz - pos; i++) {
dsl_seq_iter_delete_at(iter);
}
}
@ -350,7 +350,7 @@ sol_object_t *sol_map_get_name(sol_state_t *state, sol_object_t *map, char *name
}
void sol_map_set(sol_state_t *state, sol_object_t *map, sol_object_t *key, sol_object_t *val) {
sol_object_t *mcell =sol_map_mcell(state, map, key), *newcell, *temp;
sol_object_t *mcell = sol_map_mcell(state, map, key), *newcell, *temp;
if(sol_is_none(state, mcell)) {
newcell = sol_alloc_object(state);
newcell->type = SOL_MCELL;
@ -373,7 +373,7 @@ void sol_map_set_name(sol_state_t *state, sol_object_t *map, char *name, sol_obj
}
void sol_map_set_existing(sol_state_t *state, sol_object_t *map, sol_object_t *key, sol_object_t *val) {
sol_object_t *mcell =sol_map_mcell(state, map, key), *temp;
sol_object_t *mcell = sol_map_mcell(state, map, key), *temp;
if(!sol_is_none(state, mcell)) {
temp = mcell->val;
mcell->val = sol_incref(val);

136
parser.tab.c

@ -110,63 +110,63 @@ extern int yydebug;
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IF = 258,
THEN = 259,
ELSE = 260,
WHILE = 261,
FOR = 262,
IN = 263,
DO = 264,
FUNC = 265,
RETURN = 266,
BREAK = 267,
CONTINUE = 268,
END = 269,
NONE = 270,
IDENT = 271,
INT = 272,
FLOAT = 273,
STRING = 274,
PLUS = 275,
MINUS = 276,
STAR = 277,
SLASH = 278,
PERCENT = 279,
DSTAR = 280,
BAND = 281,
BOR = 282,
BXOR = 283,
BNOT = 284,
LAND = 285,
LOR = 286,
LNOT = 287,
ASSIGN = 288,
ASSIGNPLUS = 289,
ASSIGNMINUS = 290,
ASSIGNSTAR = 291,
ASSIGNSLASH = 292,
ASSIGNDSTAR = 293,
ASSIGNBAND = 294,
ASSIGNBOR = 295,
ASSIGNBXOR = 296,
EQUAL = 297,
LESS = 298,
GREATER = 299,
LESSEQ = 300,
GREATEREQ = 301,
RSHIFT = 302,
LSHIFT = 303,
LBRACE = 304,
RBRACE = 305,
LPAREN = 306,
RPAREN = 307,
LBRACKET = 308,
RBRACKET = 309,
DOT = 310,
COLON = 311,
SEMICOLON = 312,
COMMA = 313,
POUND = 314
IF = 258,
THEN = 259,
ELSE = 260,
WHILE = 261,
FOR = 262,
IN = 263,
DO = 264,
FUNC = 265,
RETURN = 266,
BREAK = 267,
CONTINUE = 268,
END = 269,
NONE = 270,
IDENT = 271,
INT = 272,
FLOAT = 273,
STRING = 274,
PLUS = 275,
MINUS = 276,
STAR = 277,
SLASH = 278,
PERCENT = 279,
DSTAR = 280,
BAND = 281,
BOR = 282,
BXOR = 283,
BNOT = 284,
LAND = 285,
LOR = 286,
LNOT = 287,
ASSIGN = 288,
ASSIGNPLUS = 289,
ASSIGNMINUS = 290,
ASSIGNSTAR = 291,
ASSIGNSLASH = 292,
ASSIGNDSTAR = 293,
ASSIGNBAND = 294,
ASSIGNBOR = 295,
ASSIGNBXOR = 296,
EQUAL = 297,
LESS = 298,
GREATER = 299,
LESSEQ = 300,
GREATEREQ = 301,
RSHIFT = 302,
LSHIFT = 303,
LBRACE = 304,
RBRACE = 305,
LPAREN = 306,
RPAREN = 307,
LBRACKET = 308,
RBRACKET = 309,
DOT = 310,
COLON = 311,
SEMICOLON = 312,
COMMA = 313,
POUND = 314
};
#endif
@ -965,12 +965,12 @@ __attribute__((__unused__))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
yy_location_print_ (FILE *yyo, YYLTYPE const *const yylocp)
#else
static unsigned
yy_location_print_ (yyo, yylocp)
FILE *yyo;
YYLTYPE const * const yylocp;
YYLTYPE const *const yylocp;
#endif
{
unsigned res = 0;
@ -1044,14 +1044,14 @@ do { \
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, stmt_node **program)
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, YYLTYPE const *const yylocationp, stmt_node **program)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, program)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
YYLTYPE const * const yylocationp;
YYSTYPE const *const yyvaluep;
YYLTYPE const *const yylocationp;
stmt_node **program;
#endif
{
@ -1080,14 +1080,14 @@ stmt_node **program;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, stmt_node **program)
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, YYLTYPE const *const yylocationp, stmt_node **program)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, program)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
YYLTYPE const * const yylocationp;
YYSTYPE const *const yyvaluep;
YYLTYPE const *const yylocationp;
stmt_node **program;
#endif
{
@ -1279,7 +1279,7 @@ yytnamerr (char *yyres, const char *yystr) {
if (*++yyp != '\\') {
goto do_not_strip_quotes;
}
/* Fall through. */
/* Fall through. */
default:
if (yyres) {
yyres[yyn] = *yyp;
@ -1787,7 +1787,7 @@ yyreduce:
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
yyval = yyvsp[1 - yylen];
/* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
@ -3108,7 +3108,7 @@ yyerrorlab:
goto yyerrorlab;
}
yyerror_range[1] = yylsp[1-yylen];
yyerror_range[1] = yylsp[1 - yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);

143
parser.tab.h

@ -1,19 +1,19 @@
/* A Bison parser, made by GNU Bison 2.7.12-4996. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@ -43,67 +43,67 @@ extern int yydebug;
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IF = 258,
THEN = 259,
ELSE = 260,
WHILE = 261,
FOR = 262,
IN = 263,
DO = 264,
FUNC = 265,
RETURN = 266,
BREAK = 267,
CONTINUE = 268,
END = 269,
NONE = 270,
IDENT = 271,
INT = 272,
FLOAT = 273,
STRING = 274,
PLUS = 275,
MINUS = 276,
STAR = 277,
SLASH = 278,
PERCENT = 279,
DSTAR = 280,
BAND = 281,
BOR = 282,
BXOR = 283,
BNOT = 284,
LAND = 285,
LOR = 286,
LNOT = 287,
ASSIGN = 288,
ASSIGNPLUS = 289,
ASSIGNMINUS = 290,
ASSIGNSTAR = 291,
ASSIGNSLASH = 292,
ASSIGNDSTAR = 293,
ASSIGNBAND = 294,
ASSIGNBOR = 295,
ASSIGNBXOR = 296,
EQUAL = 297,
LESS = 298,
GREATER = 299,
LESSEQ = 300,
GREATEREQ = 301,
RSHIFT = 302,
LSHIFT = 303,
LBRACE = 304,
RBRACE = 305,
LPAREN = 306,
RPAREN = 307,
LBRACKET = 308,
RBRACKET = 309,
DOT = 310,
COLON = 311,
SEMICOLON = 312,
COMMA = 313,
POUND = 314
};
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IF = 258,
THEN = 259,
ELSE = 260,
WHILE = 261,
FOR = 262,
IN = 263,
DO = 264,
FUNC = 265,
RETURN = 266,
BREAK = 267,
CONTINUE = 268,
END = 269,
NONE = 270,
IDENT = 271,
INT = 272,
FLOAT = 273,
STRING = 274,
PLUS = 275,
MINUS = 276,
STAR = 277,
SLASH = 278,
PERCENT = 279,
DSTAR = 280,
BAND = 281,
BOR = 282,
BXOR = 283,
BNOT = 284,
LAND = 285,
LOR = 286,
LNOT = 287,
ASSIGN = 288,
ASSIGNPLUS = 289,
ASSIGNMINUS = 290,
ASSIGNSTAR = 291,
ASSIGNSLASH = 292,
ASSIGNDSTAR = 293,
ASSIGNBAND = 294,
ASSIGNBOR = 295,
ASSIGNBXOR = 296,
EQUAL = 297,
LESS = 298,
GREATER = 299,
LESSEQ = 300,
GREATEREQ = 301,
RSHIFT = 302,
LSHIFT = 303,
LBRACE = 304,
RBRACE = 305,
LPAREN = 306,
RPAREN = 307,
LBRACKET = 308,
RBRACKET = 309,
DOT = 310,
COLON = 311,
SEMICOLON = 312,
COMMA = 313,
POUND = 314
};
#endif
@ -115,12 +115,11 @@ typedef int YYSTYPE;
#endif
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
typedef struct YYLTYPE {
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1

14
runtime.c

@ -303,23 +303,23 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
break;
case OP_EQUAL:
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival==0));
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival == 0));
break;
case OP_LESS:
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival<0));
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival < 0));
break;
case OP_GREATER:
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival>0));
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival > 0));
break;
case OP_LESSEQ:
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival<=0));
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival <= 0));
break;
case OP_GREATEREQ:
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival>=0));
res = sol_new_int(state, BOOL_TO_INT(sol_cast_int(state, left->ops->cmp(state, list))->ival >= 0));
break;
case OP_LSHIFT:
@ -533,7 +533,7 @@ void sol_exec(sol_state_t *state, stmt_node *stmt) {
} else {
iter = value;
}
if(!iter->ops->call || iter->ops->call==sol_f_not_impl) {
if(!iter->ops->call || iter->ops->call == sol_f_not_impl) {
sol_obj_free(sol_set_error_string(state, "Iterate over non-iterable"));
return;
}