--- parser3/src/main/compile_tools.C 2001/11/05 11:46:26 1.40 +++ parser3/src/main/compile_tools.C 2002/02/07 11:16:28 1.43 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://paf.design.ru) - $Id: compile_tools.C,v 1.40 2001/11/05 11:46:26 paf Exp $ + $Id: compile_tools.C,v 1.43 2002/02/07 11:16:28 paf Exp $ */ #include "compile_tools.h" @@ -50,6 +50,16 @@ void CCA(Array/**/ *result, A *result+=code_array; } +void PNC(Array/**/ *result, Array/**/ *code_array) { + // append OP_CODE + Operation op; op.code=OP_NESTED_CODE; + *result+=op.cast; + + // append 'vstring' + *result+=code_array; +} + + Array *VL(Value *value) { // empty ops array Array *result=N(value->pool()); @@ -63,10 +73,9 @@ Array *VL(Value *value) { Value *LA2V(Array *literal_string_array, int offset) { Operation op; op.cast=literal_string_array->get(offset+0); - if(op.code!=OP_VALUE) - return 0; - - return static_cast(literal_string_array->get(offset+1)); + return op.code==OP_VALUE? + static_cast(literal_string_array->get(offset+1)) + :0; } void change_string_literal_to_double_literal(Array *literal_string_array) { @@ -80,14 +89,15 @@ void change_string_literal_to_write_stri } void push_LS(parse_control& pc, lexical_state new_state) { - if(pc.sp=0) - pc.ls=pc.stack[pc.sp]; + if(--pc.ls_sp>=0) + pc.ls=pc.ls_stack[pc.ls_sp]; else - throw Exception(0, 0, 0, "pop_LS: stack underflow"); + throw Exception(0, 0, 0, "pop_LS: ls_stack underflow"); }