--- parser3/src/main/compile_tools.C 2002/01/24 17:18:48 1.41 +++ parser3/src/main/compile_tools.C 2002/04/15 06:45:58 1.47 @@ -1,10 +1,10 @@ /** @file Parser: compiler support helper functions. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) + Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) - $Id: compile_tools.C,v 1.41 2002/01/24 17:18:48 paf Exp $ + $Id: compile_tools.C,v 1.47 2002/04/15 06:45:58 paf Exp $ */ #include "compile_tools.h" @@ -59,6 +59,25 @@ void PNC(Array/**/ *result, A *result+=code_array; } +void PJP(Array/**/ *result, Array/**/ *code_array) { + // append OP_CODE + Operation op; op.code=OP_OBJECT_POOL; + *result+=op.cast; + + // append 'vstring' + *result+=code_array; +} + +void PSP(Array/**/ *result, Array/**/ *code_array) { + // append OP_CODE + Operation op; op.code=OP_STRING_POOL; + *result+=op.cast; + + // append 'vstring' + *result+=code_array; +} + + Array *VL(Value *value) { // empty ops array @@ -73,10 +92,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) { @@ -90,14 +108,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, "pop_LS: ls_stack underflow"); }