view tests/agcl/parsifal/good/cpp.h @ 17:12171da8943f

Don't refer to CVS.
author David A. Holland
date Tue, 31 May 2022 01:56:37 -0400
parents 13d2b8934445
children
line wrap: on
line source

#ifndef CPP_H
#define CPP_H

typedef union {
  long alignment;
  char ag_vt_2[sizeof(int)];
  char ag_vt_4[sizeof(InputToken)];
  char ag_vt_5[sizeof(TypeDefinition)];
  char ag_vt_6[sizeof(Scope *)];
} parse_vs_type;

typedef enum {
  parse_line_number_token = 1, parse_statement_token,
  parse_type_specifier_seq_token, parse_ptr_operator_token,
  parse_class_name_token, parse_explicitly_typed_identifier_token = 7,
  parse_nested_name_specifier_token, parse_translation_unit_token = 13,
  parse_declaration_list_token, parse_eof_token, parse_literal_token,
  parse_template_id_token = 25, parse_primary_expression_token,
  parse_operator_function_id_token = 29, parse_qualified_id_token,
  parse_expression_hack_1_token = 32, parse_unqualified_id_token = 34,
  parse_id_expression_token, parse_conversion_function_id_token,
  parse_namespace_name_token = 38, parse_postfix_expression_token,
  parse_expression_token = 41, parse_expression_list_token = 43,
  parse_simple_type_specifier_token = 45,
  parse_pseudo_destructor_name_token = 48, parse_type_id_token = 53,
  parse_assignment_expression_token = 59,
  parse_nonclass_type_name_token = 61, parse_unary_expression_token = 63,
  parse_cast_expression_token, parse_unary_operator_token,
  parse_new_expression_token = 67, parse_delete_expression_token,
  parse_new_token = 74, parse_new_type_id_token,
  parse_new_initializer_token, parse_new_placement_token = 78,
  parse_expression_list_hack_2_token, parse_retry_token,
  parse_resynch_token, parse_new_declarator_token,
  parse_direct_new_declarator_token, parse_constant_expression_token,
  parse_delete_token, parse_error_token,
  parse_restricted_assignment_expression_hack_5_token,
  parse_restricted_assignment_expression_token, parse_pm_expression_token,
  parse_multiplicative_expression_token = 92,
  parse_additive_expression_token = 95, parse_shift_expression_token,
  parse_relational_expression_token = 99,
  parse_equality_expression_token = 102, parse_and_expression_token = 105,
  parse_exclusive_or_expression_token,
  parse_inclusive_or_expression_token = 108,
  parse_logical_and_expression_token = 110,
  parse_logical_or_expression_token = 112,
  parse_conditional_expression_token = 114,
  parse_assignment_operator_token = 117, parse_throw_expression_token,
  parse_labeled_statement_token = 130, parse_compound_statement_token,
  parse_selection_statement_token, parse_iteration_statement_token,
  parse_jump_statement_token, parse_try_block_token,
  parse_block_declaration_token, parse_variable_declaration_token,
  parse_function_definition_2_token, parse_statement_try_2_token,
  parse_type_qualifier_token, parse_declarator_list_token = 142,
  parse_function_definition_1_token = 144, parse_statement_try_3_token,
  parse_expression_statement_token, parse_begin_block_token = 149,
  parse_statement_seq_token, parse_condition_token = 155,
  parse_condition_kernel_token = 158, parse_declarator_token,
  parse_condition_kernel_2_token, parse_for_header_token = 163,
  parse_for_init_statement_token, parse_for_init_token = 169,
  parse_for_variable_declaration_token, parse_for_init_2_token,
  parse_decl_specifier_seq_token, parse_init_declarator_list_token,
  parse_declaration_seq_token = 178, parse_declaration_hack_token,
  parse_declaration_token, parse_simple_declaration_token,
  parse_explicit_instantiation_token, parse_explicit_specialization_token,
  parse_linkage_specification_token, parse_namespace_definition_token,
  parse_asm_definition_token, parse_namespace_alias_definition_token,
  parse_using_declaration_token, parse_using_directive_token,
  parse_template_header_token, parse_attempt_declarator_list_token = 192,
  parse_resynch_text_token, parse_balanced_braces_token,
  parse_resynch_item_token, parse_balanced_parens_token = 197,
  parse_balanced_brackets_token, parse_not_right_paren_token,
  parse_not_right_bracket_token, parse_not_right_brace_token,
  parse_fundamental_type_token = 206, parse_predefined_specifier_token,
  parse_user_defined_specifier_token = 211,
  parse_restricted_decl_specifier_seq_token = 213,
  parse_restricted_specifier_token, parse_qualified_type_name_token,
  parse_storage_class_specifier_token, parse_function_specifier_token = 222,
  parse_cv_qualifier_token = 228, parse_class_specifier_token = 240,
  parse_enum_specifier_token, parse_elaborated_type_specifier_token,
  parse_user_type_specifier_token, parse_class_key_token = 246,
  parse_name_qualifier_token, parse_template_argument_list_token = 249,
  parse_enumerator_list_token = 251,
  parse_enumerator_definition_token = 253,
  parse_named_namespace_definition_token = 256,
  parse_unnamed_namespace_definition_token,
  parse_original_namespace_definition_token,
  parse_extension_namespace_definition_token,
  parse_namespace_body_token = 261,
  parse_qualified_namespace_specifier_token,
  parse_init_declarator_token = 265, parse_direct_declarator_token,
  parse_initializer_token, parse_declarator_id_token,
  parse_parameter_declaration_clause_hack_4_token,
  parse_cv_qualifier_seq_token, parse_exception_specification_token = 272,
  parse_declarator_hack_token = 275, parse_direct_declarator_hack_token,
  parse_declarator_hack_3_token, parse_abstract_declarator_token = 281,
  parse_abstract_declarator_hack_token = 285,
  parse_direct_abstract_declarator_hack_token = 287,
  parse_parameter_declaration_clause_hack_3_token,
  parse_parameter_declaration_clause_token,
  parse_direct_abstract_declarator_token = 291,
  parse_parameter_declaration_list_token,
  parse_parameter_declaration_token = 294,
  parse_expression_list_hack_4_token = 296,
  parse_constructor_identifier_token = 300, parse_ctor_initializer_token,
  parse_function_body_token = 303, parse_constructor_try_block_token,
  parse_handler_seq_token = 306, parse_function_identifier_token,
  parse_function_try_block_token, parse_initializer_clause_token,
  parse_initializer_list_token, parse_class_head_token = 312,
  parse_member_specification_token, parse_base_clause_token = 315,
  parse_specifier_lookahead_token,
  parse_member_declaration_hack_token = 321, parse_member_declaration_token,
  parse_member_restore_token, parse_member_declarator_list_token,
  parse_access_specifier_token = 326, parse_member_declarator_token,
  parse_pure_specifier_token, parse_constant_intializer_token,
  parse_base_specifier_list_token = 331, parse_base_specifier_token,
  parse_qualified_class_name_token, parse_conversion_type_id_token = 340,
  parse_conversion_declarator_token, parse_mem_initializer_list_token = 343,
  parse_mem_initializer_token, parse_mem_initializer_id_token,
  parse_operator_token, parse_template_parameter_list_token = 348,
  parse_template_parameter_token, parse_type_parameter_token,
  parse_template_parameter_declaration_token,
  parse_restricted_conditional_expression_token,
  parse_restricted_throw_expression_token,
  parse_template_argument_token = 357, parse_handler_token,
  parse_exception_declaration_token = 360, parse_type_id_list_token = 362,
  parse_HEXconstant_token = 367, parse_OCTconstant_token,
  parse_DECconstant_token, parse_FLOATconstant_token,
  parse_CHARACTERconstant_token, parse_STRINGliteral_token,
  parse_CLASS_NAME_token, parse_THIS_token, parse_IDENTIFIER_token,
  parse_QUAL_token, parse_TEMPLATE_token = 379, parse_ARROW_token = 383,
  parse_INCR_token, parse_DECR_token, parse_DYNAMIC_CAST_token = 388,
  parse_STATIC_CAST_token, parse_REINTERPRET_CAST_token,
  parse_CONST_CAST_token, parse_TYPEID_token, parse_SIZEOF_token = 395,
  parse_NEW_token = 401, parse_DELETE_token, parse_DOT_STAR_token,
  parse_ARROW_STAR_token, parse_LS_token = 407, parse_RS_token,
  parse_LE_token, parse_GE_token, parse_EQ_token, parse_NE_token,
  parse_AND_token = 415, parse_OR_token, parse_MULT_EQ_token = 420,
  parse_DIV_EQ_token, parse_MOD_EQ_token, parse_ADD_EQ_token,
  parse_SUB_EQ_token, parse_LS_EQ_token, parse_RS_EQ_token,
  parse_AND_EQ_token, parse_OR_EQ_token, parse_XOR_EQ_token,
  parse_CASE_token = 431, parse_DEFAULT_token, parse_IF_token = 435,
  parse_ELSE_token, parse_SWITCH_token, parse_WHILE_token, parse_DO_token,
  parse_FOR_token, parse_BREAK_token, parse_CONTINUE_token,
  parse_RETURN_token, parse_GOTO_token, parse_EXPORT_token,
  parse_AUTO_token, parse_REGISTER_token, parse_STATIC_token,
  parse_EXTERN_token, parse_MUTABLE_token, parse_INLINE_token,
  parse_VIRTUAL_token, parse_EXPLICIT_token, parse_FRIEND_token,
  parse_TYPEDEF_token, parse_CHAR_token, parse_WCHAR_T_token,
  parse_BOOL_token, parse_SHORT_token, parse_INT_token, parse_LONG_token,
  parse_SIGNED_token, parse_UNSIGNED_token, parse_FLOAT_token,
  parse_DOUBLE_token, parse_VOID_token, parse_ENUM_NAME_token,
  parse_TYPEDEF_NAME_token, parse_ENUM_token, parse_TYPENAME_token,
  parse_NAMESPACE_NAME_token, parse_NAMESPACE_ALIAS_token,
  parse_NAMESPACE_token, parse_USING_token, parse_ASM_token,
  parse_CONSTANT_token, parse_VOLATILE_token, parse_TEMPLATE_NAME_token,
  parse_ELLIPSIS_token, parse_TRY_token, parse_CLASS_token,
  parse_STRUCT_token, parse_UNION_token, parse_PRIVATE_token = 485,
  parse_PROTECTED_token, parse_PUBLIC_token, parse_OPERATOR_token,
  parse_THROW_token, parse_CATCH_token, parse_LINE_token = 492
} parse_token_type;

typedef struct parse_pcb_struct{
  parse_token_type token_number, reduction_token, error_frame_token;
  int input_code;
  InputToken input_value;
  int line, column;
  int ssx, sn, error_frame_ssx;
  int drt, dssx, dsn;
  int ss[128];
  parse_vs_type vs[128];
  int ag_ap;
  const char *error_message;
  char read_flag;
  char exit_flag;
  ParserState input_context;
  ParserState cs[128];
  int bts[128], btsx;
  InputToken * pointer;
  InputToken * la_ptr;
  char ag_msg[82];
} parse_pcb_type;

#ifndef PRULE_CONTEXT
#define PRULE_CONTEXT(pcb)  (&((pcb).cs[(pcb).ssx]))
#define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx])
#define PCONTEXT(pcb)       ((pcb).cs[(pcb).ssx])
#endif

#ifndef AG_RUNNING_CODE
/* PCB.exit_flag values */
#define AG_RUNNING_CODE         0
#define AG_SUCCESS_CODE         1
#define AG_SYNTAX_ERROR_CODE    2
#define AG_REDUCTION_ERROR_CODE 3
#define AG_STACK_ERROR_CODE     4
#define AG_SEMANTIC_ERROR_CODE  5
#endif
void init_parse(void);
void parse(void);
#endif