Annotation of parser3/src/include/pa_operation.h, revision 1.7

1.2       paf         1: /** @file
                      2:        Parser: compiled code related decls.
                      3: 
1.6       paf         4:        Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com)
1.2       paf         5: 
                      6:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
                      7: */
                      8: 
                      9: #ifndef OPERATION_H
                     10: #define OPERATION_H
                     11: 
1.7     ! misha      12: static const char * const IDENT_OPERATION_H="$Date: 2005/08/09 08:14:49 $";
1.2       paf        13: 
                     14: #include "pa_array.h"
                     15: #include "pa_opcode.h"
                     16: #include "pa_value.h"
                     17: 
                     18: // forwards
                     19: 
                     20: union Operation;
                     21: typedef Array<Operation> ArrayOperation;
                     22: 
                     23: /** 
                     24:        Parser source code got compiled into intermediate form of Operation-s, 
                     25:        which are executed afterwards.
                     26: 
                     27:        It is compiled into Array of Operation-s.
                     28:        Each Operation can be either OPCODE or data pointer, 
                     29:        following the literal-instruction.
                     30:                - OP_VALUE followed by Origin, followed by Value*
                     31:                - OP_CURLY_CODE__STORE_PARAM followed by ArrayOperation*
                     32:                - OP_EXPR_CODE__STORE_PARAM followed by ArrayOperation*
                     33:                - OP_NESTED_CODE followed by ArrayOperation*
                     34: */
                     35: union Operation {
                     36:        struct Origin {
                     37:                uint file_no:8; ///< file number (max: 255): index in Request::file_list
                     38:                uint line:8+8; ///< line number (max: 64535)
                     39:                uint col:8; ///< column number (max: 255)
                     40: 
                     41:                static Origin create(uint afile_no, uint aline, uint acol) {
                     42:                        Origin result={afile_no, aline, acol};
1.3       paf        43:                        return result;
1.2       paf        44:                }
                     45:        };
                     46: 
1.7     ! misha      47:        OP::OPCODE code; ///< operation code
1.2       paf        48:        Origin origin; ///< not an operation, but rather debug information: [OP_VALUE; debug_info; Value*]
                     49:        Value* value; ///< not an operation, but rather value stored after argumented op
                     50:        ArrayOperation* ops; ///< not an operation, but rather code array stored after argumented op
                     51: 
                     52:        /// needed to fill unused Array entries
                     53:        Operation() {}
1.7     ! misha      54:        Operation(OP::OPCODE acode): code(acode) {}
1.2       paf        55:        Operation(uint afile_no, uint aline, uint acol): 
                     56:                origin(Origin::create(afile_no, aline, acol)) {}
                     57:        Operation(Value* avalue): value(avalue) {}
                     58:        Operation(ArrayOperation* aops): ops(aops) {}   
                     59: };
                     60: 
                     61: // defines
                     62: 
                     63: #define OPERATIONS_PER_OPVALUE 3
                     64: 
                     65: #endif

E-mail: