Annotation of parser3/src/main/compile_tools.h, revision 1.1
1.1 ! paf 1: /*
! 2: $Id: core.C,v 1.20 2001/02/20 12:18:28 paf Exp $
! 3: */
! 4:
! 5: #ifndef COMPILE_TOOLS
! 6: #define COMPILE_TOOLS
! 7:
! 8: #include "code.h"
! 9: #include "pa_types.h"
! 10:
! 11: enum lexical_state {
! 12: LS_USER,
! 13: LS_VAR_NAME_SIMPLE,
! 14: LS_VAR_NAME_CURLY,
! 15: LS_VAR_ROUND,
! 16: LS_VAR_CURLY,
! 17: LS_METHOD_NAME,
! 18: LS_METHOD_ROUND,
! 19: LS_METHOD_CURLY,
! 20: LS_METHOD_AFTER
! 21: };
! 22: struct parse_control {
! 23: /* input */
! 24: void *pool;
! 25: #ifndef NO_CSTRING_ORIGIN
! 26: char *source;
! 27: char *file;
! 28: int line;
! 29: #endif
! 30: /* state */
! 31: int pending_state/*=0*/;
! 32: void *string/*=string_create(...)*/;
! 33:
! 34: #define MAX_LEXICAL_STATES 100
! 35: enum lexical_state ls/*=LS_USER*/;
! 36: int sp/*=0*/;
! 37: enum lexical_state stack[MAX_LEXICAL_STATES];
! 38: int brackets_nestages[MAX_LEXICAL_STATES];
! 39:
! 40: /* output: Array * */
! 41: void *result;
! 42: };
! 43:
! 44: #ifdef __cplusplus
! 45: extern "C" {
! 46: #endif
! 47: /* New array // return empty array */
! 48: void *N(void *apool);
! 49:
! 50: /* Assembler instruction // append ordinary instruction to result */
! 51: void A(void **result, enum OPCODE acode);
! 52:
! 53: /* Assembler parametrized instruction // append instruction; append param */
! 54: void AP(void **result, enum OPCODE acode, void *param);
! 55:
! 56: /* Literal // returns array with
! 57: // first: OP_STRING instruction
! 58: // second op: string itself
! 59: */
! 60: void *L(void *astring);
! 61: /* Literal String // return string value from literal array OP+string array */
! 62: void *LS(void *literal);
! 63:
! 64: /* aPpend code array // append code_array to result */
! 65: void P(void **result, void *code_array);
! 66:
! 67:
! 68: void push_LS(struct parse_control *pc);
! 69: void pop_LS(struct parse_control *pc);
! 70:
! 71: void *string_create(void *pool);
! 72:
! 73: #ifndef NO_STRING_ORIGIN
! 74: # define CSTRING_APPEND_PARAMS void *astring, char *piece, size_t size, char *file, uint line
! 75: # define CSTRING_APPEND(astring, piece, size, file, line) real_cstring_append(astring, piece, size, file, line)
! 76: #else
! 77: # define CSTRING_APPEND_PARAMS void *astring, char *piece, size_t size
! 78: # define CSTRING_APPEND(astring, piece, size, file, line) real_cstring_append(astring, piece, size)
! 79: #endif
! 80: void real_cstring_append(CSTRING_APPEND_PARAMS);
! 81: char *string_cstr(void *astring);
! 82:
! 83: void exception(void *pool,
! 84: void *atype, void *acode,
! 85: void *aproblem_source,
! 86: char *acomment);
! 87:
! 88: #ifdef __cplusplus
! 89: }
! 90: #endif
! 91:
! 92: #endif
E-mail: