|
|
| version 1.22, 2002/09/20 09:26:31 | version 1.26, 2003/11/20 16:34:25 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: compiled code related decls. | Parser: compiled code related decls. |
| Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| #ifndef CODE_H | #ifndef OPCODE_H |
| #define CODE_H | #define OPCODE_H |
| static const char* IDENT_OPCODE_H="$Date$"; | static const char * const IDENT_OPCODE_H="$Date$"; |
| #include "pa_string.h" | |
| #include "pa_array.h" | |
| class Value; | |
| class Array; | |
| /// Compiled operation code | /// Compiled operation code |
| enum OPCODE { | enum OPCODE { |
| Line 31 enum OPCODE { | Line 25 enum OPCODE { |
| OP_GET_CLASS, | OP_GET_CLASS, |
| OP_CONSTRUCT_VALUE, OP_CONSTRUCT_EXPR, OP_CURLY_CODE__CONSTRUCT, | OP_CONSTRUCT_VALUE, OP_CONSTRUCT_EXPR, OP_CURLY_CODE__CONSTRUCT, |
| OP_WRITE_VALUE, OP_WRITE_EXPR_RESULT, OP_STRING__WRITE, | OP_WRITE_VALUE, OP_WRITE_EXPR_RESULT, OP_STRING__WRITE, |
| OP_GET_ELEMENT_OR_OPERATOR, OP_GET_ELEMENT_OR_JUNCTION_EXPAND, | OP_GET_ELEMENT_OR_OPERATOR, OP_GET_ELEMENT, OP_GET_ELEMENT__WRITE, |
| OP_GET_ELEMENT, OP_GET_ELEMENT__WRITE, | |
| OP_OBJECT_POOL, OP_STRING_POOL, | OP_OBJECT_POOL, OP_STRING_POOL, |
| OP_STORE_PARAM, | OP_STORE_PARAM, |
| OP_PREPARE_TO_CONSTRUCT_OBJECT, OP_PREPARE_TO_EXPRESSION, | OP_PREPARE_TO_CONSTRUCT_OBJECT, OP_PREPARE_TO_EXPRESSION, |
| Line 56 enum OPCODE { | Line 49 enum OPCODE { |
| //@} | //@} |
| }; | }; |
| /** | |
| Parser source code got compiled into intermediate form of Operation-s, | |
| which is executed afterwards. | |
| It is compiled into Array of Operation-s. | |
| Each Operation can be either OPCODE or data pointer, | |
| following the literal-instruction. | |
| - OP_VALUE followed by Value* | |
| - OP_CURLY_CODE__STORE_PARAM followed by Array* | |
| - OP_EXPR_CODE__STORE_PARAM followed by Array* | |
| - OP_NESTED_CODE followed by Array* | |
| */ | |
| union Operation { | |
| void *cast; ///< casting helper | |
| OPCODE code; ///< operation code | |
| Value *value; ///< not an operation, but rather value stored after argumented op | |
| Array *array; ///< not an operation, but rather code array stored after argumented op | |
| }; | |
| #endif | #endif |