176 ws_src_error(compiler, line,
"too many local variables");
385 "`%s' previously defined here",
name);
400 switch (expr->
type) {
424 if (expr->
u.
assign.op ==
'=') {
509 ws_fatal(
"ws_expr_linearize(): unknown assignment operand %x",
658 for (li = expr->
u.
call.arguments->head; li; li = li->
next)
662 switch (expr->
u.
call.type) {
670 "unknown local function `%s'",
677 if (expr->
u.
call.arguments->num_items
681 "invalid amount of arguments for `%s': " 682 "expected %u, got %u",
685 expr->
u.
call.arguments->num_items);
704 "unknown external compilation unit `%s'",
711 compiler->
bc, &findex,
712 (
unsigned char *) expr->
u.
call.name,
713 strlen(expr->
u.
call.name)))
723 expr->
u.
call.arguments->num_items));
736 &lindex, &findex, &num_args,
737 &lindex_found, &findex_found))
741 "unknown system library `%s'",
745 "unknown library function `%s.%s'",
751 if (expr->
u.
call.arguments->num_items != num_args)
754 "invalid amount of arguments for `%s.%s': " 755 "expected %u, got %u",
757 num_args, expr->
u.
call.arguments->num_items);
768 ws_fatal(
"ws_expr_linearize(): unknown call expression type %x",
819 "integer literal too large");
895 expr->
u.
comma.left = left;
896 expr->
u.
comma.right = right;
910 if (e->
u.
assign.identifier == NULL)
986 expr->
u.
unary.expr = expression;
994 WsBool addp,
char *variable)
1011 WsBool addp,
char *variable)
1037 expr->
u.
call.arguments = arguments;
1039 if ((base && expr->
u.
call.base == NULL)
1106 expr->
u.
fval = fval;
1140 for (li = list->
head; li; li = li->
next) {
1144 if (ns && vardec->
expr) {
1162 switch (stmt->
type) {
1187 (stmt->
u.
s_if.s_else
1188 ? stmt->
u.
s_if.s_else->first_line
1208 if (stmt->
u.
s_if.s_else)
1241 else if (stmt->
u.
s_for.e1) {
1338 "continue statement not within a loop");
1348 "break statement not within a loop");
1407 stmt->
u.
var = variables;
1425 stmt->
u.
expr = expr;
1438 stmt->
u.
s_if.expr = expr;
1439 stmt->
u.
s_if.s_then = s_then;
1440 stmt->
u.
s_if.s_else = s_else;
1458 stmt->
u.
s_for.stmt = stmt_body;
1497 stmt->
u.
expr = expr;
void ws_function(WsCompiler *compiler, WsBool externp, char *name, WsUInt32 line, WsList *params, WsList *block)
void ws_asm_link(WsCompiler *compiler, WsAsmIns *ins)
void error(int err, const char *fmt,...)
void ws_fatal(char *fmt,...)
void * ws_calloc(size_t num, size_t size)
#define WS_ASM_CONST_TRUE
WsHashPtr pragma_use_hash
struct WsListItemRec * next
WsStatement * ws_stmt_empty(WsCompiler *compiler, WsUInt32 line)
struct WsStatementRec::@129::@130 s_if
static void function_hash_destructor(void *item, void *context)
WsStatement * ws_stmt_for(WsCompilerPtr compiler, WsUInt32 line, WsList *init, WsExpression *e1, WsExpression *e2, WsExpression *e3, WsStatement *stmt_body)
WsExpression * ws_expr_postfix_var(WsCompilerPtr compiler, WsUInt32 line, WsBool addp, char *variable)
WsExpression * ws_expr_call(WsCompiler *compiler, WsUInt32 line, int type, char *base, char *name, WsList *arguments)
WsAsmIns * ws_asm_call_lib(WsCompiler *compiler, WsUInt32 line, WsUInt8 findex, WsUInt16 lindex)
WsAsmIns * ws_asm_branch(WsCompiler *compiler, WsUInt32 line, WsUInt16 inst, WsAsmIns *label)
WsStatement * ws_stmt_return(WsCompilerPtr compiler, WsUInt32 line, WsExpression *expr)
WsBool ws_stdlib_function(const char *library, const char *function, WsUInt16 *lindex_return, WsUInt8 *findex_return, WsUInt8 *num_args_return, WsBool *lindex_found_return, WsBool *findex_found_return)
void ws_pragma_meta_body_free(WsCompilerPtr compiler, WsPragmaMetaBody *mb)
static WsStatement * stmt_alloc(WsCompiler *compiler, WsStatementType type, WsUInt32 first_line, WsUInt32 last_line)
WsStatement * ws_stmt_continue(WsCompiler *compiler, WsUInt32 line)
WsUInt32 num_local_functions
WsAsmIns * ws_asm_label(WsCompiler *compiler, WsUInt32 line)
void ws_expr_linearize(WsCompiler *compiler, WsExpression *expr)
WsExpression * ws_expr_binary(WsCompilerPtr compiler, WsUInt32 line, int type, WsExpression *left, WsExpression *right)
WsAsmIns * ws_asm_call_url(WsCompiler *compiler, WsUInt32 line, WsUInt16 findex, WsUInt16 urlindex, WsUInt8 args)
struct WsContBreakRec * next
struct WsExpressionRec::@118::@123 binary
void * ws_realloc(void *ptr, size_t size)
#define WS_ASM_CONST_INVALID
WsUtf8String * property_name
WsVarDec * ws_variable_declaration(WsCompilerPtr compiler, char *name, WsExpression *expr)
#define WS_ASM_CONST_FALSE
struct WsExpressionRec::@118::@124 unary
void * ws_f_memdup(WsFastMalloc *pool, const void *ptr, size_t size)
WsStatement * ws_stmt_expr(WsCompiler *compiler, WsUInt32 line, WsExpression *expr)
WsStatement * ws_stmt_while(WsCompiler *compiler, WsUInt32 line, WsExpression *expr, WsStatement *stmt_arg)
static void linearize_variable_init(WsCompiler *compiler, WsList *list, WsUInt32 line)
WsAsmIns * ws_asm_load_const(WsCompiler *compiler, WsUInt32 line, WsUInt16 cindex)
struct WsStatementRec::@129::@132 s_while
WsExpression * ws_expr_const_string(WsCompiler *compiler, WsUInt32 line, WsUtf8String *string)
WsPragmaMetaBody * ws_pragma_meta_body(WsCompilerPtr compiler, WsUtf8String *property_name, WsUtf8String *content, WsUtf8String *scheme)
void ws_lexer_free_block(WsCompiler *compiler, void *ptr)
WsExpression * ws_expr_const_float(WsCompiler *compiler, WsUInt32 line, WsFloat fval)
WsAsmIns * ws_asm_call(WsCompiler *compiler, WsUInt32 line, WsUInt8 findex)
struct WsExpressionRec::@118::@126 postfix_var
WsHashPtr ws_pragma_use_hash_create(void)
WsExpression * ws_expr_symbol(WsCompiler *compiler, WsUInt32 line, char *identifier)
WsExpression * ws_expr_const_integer(WsCompiler *compiler, WsUInt32 line, WsUInt32 ival)
struct WsExpressionRec::@118::@125 unary_var
WsNamespace * ws_variable_lookup(WsCompilerPtr compiler, char *name)
WsFormalParm * ws_formal_parameter(WsCompilerPtr compiler, WsUInt32 line, char *name)
WsStatement * ws_stmt_break(WsCompiler *compiler, WsUInt32 line)
WsStatement * ws_stmt_if(WsCompiler *compiler, WsUInt32 line, WsExpression *expr, WsStatement *s_then, WsStatement *s_else)
WsHashPtr ws_function_hash_create(void)
void * ws_f_strdup(WsFastMalloc *pool, const char *str)
struct WsExpressionRec::@118::@122 logical
WsExpression * ws_expr_const_true(WsCompiler *compiler, WsUInt32 line)
#define WS_ASM_P_LOAD_VAR
void ws_pragma_use(WsCompilerPtr compiler, WsUInt32 line, char *identifier, WsUtf8String *url)
WsBool ws_bc_add_const_float(WsBc *bc, WsUInt16 *index_return, WsFloat value)
static void pragma_use_hash_destructor(void *item, void *context)
WsAsmIns * ws_asm_variable(WsCompiler *compiler, WsUInt32 line, WsUInt16 inst, WsUInt8 vindex)
struct WsExpressionRec::@118::@121 conditional
WsStatement * ws_stmt_variable(WsCompilerPtr compiler, WsUInt32 line, WsList *variables)
WsExpression * ws_expr_unary(WsCompilerPtr compiler, WsUInt32 line, int type, WsExpression *expression)
static void variable_hash_destructor(void *item, void *context)
WsAsmIns * ws_asm_ins(WsCompiler *compiler, WsUInt32 line, WsUInt8 opcode)
WsExpression * ws_expr_logical(WsCompilerPtr compiler, WsUInt32 line, int type, WsExpression *left, WsExpression *right)
WsExpression * ws_expr_const_false(WsCompiler *compiler, WsUInt32 line)
WsBool ws_bc_add_const_int(WsBc *bc, WsUInt16 *index_return, WsInt32 value)
WsList * ws_list_new(WsCompiler *compiler)
WsFunctionHash * ws_function_hash(WsCompilerPtr compiler, char *name)
static WsExpression * expr_alloc(WsCompiler *compiler, WsExpressionType type, WsUInt32 line)
WsHashPtr ws_variable_hash_create(void)
WsBool ws_bc_add_const_utf8_string(WsBc *bc, WsUInt16 *index_return, const unsigned char *data, size_t len)
#define WS_ASM_P_STORE_VAR
void * ws_f_calloc(WsFastMalloc *pool, size_t num, size_t size)
WsNamespace * ws_variable_define(WsCompilerPtr compiler, WsUInt32 line, WsBool variablep, char *name)
WsUInt32 num_extern_functions
WsExpression * ws_expr_const_invalid(WsCompiler *compiler, WsUInt32 line)
WsExpression * ws_expr_conditional(WsCompilerPtr compiler, WsUInt32 line, WsExpression *e_cond, WsExpression *e_then, WsExpression *e_else)
union WsStatementRec::@129 u
WsExpression * ws_expr_comma(WsCompilerPtr compiler, WsUInt32 line, WsExpression *left, WsExpression *right)
#define WS_ASM_B_RSZSHIFT
union WsExpressionRec::@118 u
WsFastMalloc * pool_stree
WsStatement * ws_stmt_block(WsCompiler *compiler, WsUInt32 fline, WsUInt32 lline, WsList *block)
struct WsExpressionRec::@118::@120 assign
struct WsExpressionRec::@118::@127 call
void ws_lexer_free_utf8(WsCompiler *compiler, WsUtf8String *string)
void * ws_f_malloc(WsFastMalloc *pool, size_t size)
#define WS_ASM_P_INCR_VAR
struct WsExpressionRec::@118::@128 integer
struct WsExpressionRec::@118::@119 comma
WsExpression * ws_expr_unary_var(WsCompilerPtr compiler, WsUInt32 line, WsBool addp, char *variable)
void ws_src_error(WsCompilerPtr compiler, WsUInt32 line, char *message,...)
struct WsStatementRec::@129::@131 s_for
WsBool ws_hash_put(WsHashPtr hash, const char *name, void *data)
void * ws_hash_get(WsHashPtr hash, const char *name)
WsExpression * ws_expr_assign(WsCompilerPtr compiler, WsUInt32 line, char *identifier, int op, WsExpression *expr)
void ws_error_memory(WsCompilerPtr compiler)
void ws_list_append(WsCompiler *compiler, WsList *list, void *value)
WsHashPtr ws_hash_create(WsHashItemDestructor destructor, void *context)
void ws_stmt_linearize(WsCompiler *compiler, WsStatement *stmt)