|
|
| version 1.27, 2001/03/11 08:16:34 | version 1.33, 2001/03/19 17:42:15 |
|---|---|
| Line 1 | Line 1 |
| /* | /** @file |
| Parser | Parser: compiler support helper functions decls. |
| Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) | Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf) |
| $Id$ | $Id$ |
| Line 38 struct parse_control { | Line 40 struct parse_control { |
| // input | // input |
| Pool *pool; | Pool *pool; |
| Request *request; | Request *request; |
| VClass *vclass; | VStateless_class *cclass; |
| #ifndef NO_CSTRING_ORIGIN | #ifndef NO_CSTRING_ORIGIN |
| char *source; | const char *source; |
| char *file; | const char *file; |
| int line, col; | int line, col; |
| #endif | #endif |
| // state | // state |
| Line 59 struct parse_control { | Line 61 struct parse_control { |
| }; | }; |
| // New array // return empty array | // New array // return empty array |
| inline Array/*<op>*/ *N(Pool& pool) { | inline Array/*<Operation>*/ *N(Pool& pool) { |
| return new(pool) Array/*<op>*/(pool); | return new(pool) Array/*<Operation>*/(pool); |
| } | } |
| // Assembler instruction // append ordinary instruction to ops | // Assembler instruction // append ordinary instruction to ops |
| inline void O(Array/*<op>*/ *result, enum OPCODE code) { | inline void O(Array/*<Operation>*/ *result, enum OPCODE code) { |
| Operation op; op.code=code; | Operation op; op.code=code; |
| *result+=op.cast; | *result+=op.cast; |
| } | } |
| // Argument Eval_expression // append eval_expression to ops | // Argument Eval_expression // append eval_expression to ops |
| inline void AE(Array/*<op>*/ *result, char *eval_expression) { | inline void AE(Array/*<Operation>*/ *result, char *eval_expression) { |
| *result+=eval_expression; | *result+=eval_expression; |
| } | } |
| // aPpend 'code_array' to 'result' | // aPpend 'code_array' to 'result' |
| inline void P(Array/*<op>*/ *result, Array *code_array) { | inline void P(Array/*<Operation>*/ *result, Array *code_array) { |
| result->append_array(*code_array); | result->append_array(*code_array); |
| } | } |
| // aPpend part of 'code_array', starting from offset, to 'result' | // aPpend part of 'code_array', starting from offset, to 'result' |
| inline void P(Array/*<op>*/ *result, Array *code_array, int offset) { | inline void P(Array/*<Operation>*/ *result, Array *code_array, int offset) { |
| result->append_array(*code_array, offset); | result->append_array(*code_array, offset); |
| } | } |
| // aPpend 'vstring' to 'result' | // aPpend 'vstring' to 'result' |
| void PV(Array/*<op>*/ *result, VString *vstring); | void PV(Array/*<Operation>*/ *result, VString *vstring); |
| // aPpend 'Code_Array' to result | // aPpend 'simple Code_Array' to result |
| void PCA(Array/*<op>*/ *result, Array/*<op>*/ *code_array); | void PCA(Array/*<Operation>*/ *result, Array/*<Operation>*/ *code_array); |
| // aPpend 'expression Code_Array' to result | |
| void PEA(Array/*<Operation>*/ *result, Array/*<Operation>*/ *code_array); | |
| // Value Literal // returns array with | // Value Literal // returns array with |
| // first: OP_VALUE instruction | // first: OP_VALUE instruction |