--- parser3/src/main/compile_tools.h 2001/02/24 08:28:37 1.13 +++ parser3/src/main/compile_tools.h 2001/03/07 12:11:29 1.22 @@ -1,5 +1,5 @@ /* - $Id: compile_tools.h,v 1.13 2001/02/24 08:28:37 paf Exp $ + $Id: compile_tools.h,v 1.22 2001/03/07 12:11:29 paf Exp $ */ #ifndef COMPILE_TOOLS @@ -7,10 +7,8 @@ #include "code.h" #include "pa_types.h" -#include "pa_pool.h" -#include "pa_array.h" -#include "pa_string.h" #include "pa_vstring.h" +#include "pa_request.h" enum lexical_state { LS_USER, @@ -18,19 +16,25 @@ enum lexical_state { LS_DEF_PARAMS, LS_DEF_LOCALS, LS_DEF_COMMENT, + LS_DEF_SPECIAL_BODY, + LS_EXPRESSION_STRING, + LS_EXPRESSION_VAR_NAME, LS_VAR_NAME_SIMPLE, LS_VAR_NAME_CURLY, LS_VAR_ROUND, + LS_VAR_SQUARE, LS_VAR_CURLY, LS_METHOD_NAME, - LS_METHOD_ROUND, + LS_METHOD_SQUARE, LS_METHOD_CURLY, + LS_METHOD_ROUND, LS_METHOD_AFTER }; struct parse_control { // input Pool *pool; - Array *methods; + Request *request; + VClass *vclass; #ifndef NO_CSTRING_ORIGIN char *source; char *file; @@ -56,7 +60,7 @@ inline Array/**/ *N(Pool& pool) { } // Assembler instruction // append ordinary instruction to ops -inline void OP(Array/**/ *result, enum OPCODE code) { +inline void O(Array/**/ *result, enum OPCODE code) { Operation op; op.code=code; *result+=op.cast; } @@ -75,18 +79,25 @@ inline void P(Array/**/ *result, Arr result->append_array(*code_array, offset); } // aPpend 'vstring' to 'result' -void PVS(Array/**/ *result, VString *vstring); +void PV(Array/**/ *result, VString *vstring); // aPpend 'Code_Array' to result void PCA(Array/**/ *result, Array/**/ *code_array); -// Literal // returns array with -// first: OP_STRING instruction +// Value Literal // returns array with +// first: OP_VALUE instruction // second op: string itself - -Array *L(VString *vstring); +Array *VL(Value *value); // Literal Array to(2) String // return string value from literal array OP+string array -String *LA2S(Array *literal_string_array, int offset=0); +String *SLA2S(Array *literal_string_array, int offset=0); + +void change_string_literal_to_double_literal(Array *literal_string_array); + +// Class Literal // returns array with +// first: OP_CLASS instruction +// second op: vclass itself +Array *CL(VClass *vclass); + void push_LS(struct parse_control *pc, lexical_state new_state); void pop_LS(struct parse_control *pc);