view anagram/agcore/cf.h @ 21:1c9dac05d040

Add lint-style FALLTHROUGH annotations to fallthrough cases. (in the parse engine and thus the output code) Document this, because the old output causes warnings with gcc10.
author David A. Holland
date Mon, 13 Jun 2022 00:04:38 -0400
parents 13d2b8934445
children 5581ef01f993
line wrap: on
line source

#ifndef CF_H_1198348333
#define CF_H_1198348333

typedef enum {
  cf_config_file_token = 1, cf_equals_token, cf_space_token = 4,
  cf_minus_token = 6, cf_plus_token = 8, cf_tilde_token = 10,
  cf_left_parenthesis_token = 12, cf_right_parenthesis_token = 14,
  cf_blank_token = 16, cf_global_parameter_token = 19, cf_end_of_line_token,
  cf_eof_token = 24, cf_name_token, cf_data_type_token,
  cf_keyword_string_token, cf_number_token, cf_abstract_declarator_token,
  cf_indirect_data_type_token, cf_direct_abstract_declarator_token,
  cf_pointer_token = 33, cf_star_token, cf_name_string_token = 36,
  cf_letter_token, cf_blank_char_token = 39, cf_c_comment_token,
  cf_continuation_token, cf_comment_token, cf_next_line_token,
  cf_carriage_return_token, cf_newline_token = 46, cf_white_token,
  cf_vertical_space_token, cf_decimal_number_token = 53,
  cf_octal_number_token = 56, cf_hex_number_token = 59,
  cf_simple_number_token = 63, cf_sign_token,
  cf_keyword_string_head_token = 66, cf_string_token, cf_double_quote_token,
  cf_string_A_token, cf_string_B_token, cf_string_C_token,
  cf_string_char_token, cf_simple_string_char_token,
  cf_escape_sequence_token, cf_three_octal_token = 86, cf_one_octal_token,
  cf_backslash_token, cf_two_octal_token, cf_octal_escape_token,
  cf_hex_escape_token = 92, cf_any_digit_token = 94,
  cf_nonoctal_digit_token, cf_c_comment_text_token
} cf_token_type;

typedef struct cf_pcb_struct{
  cf_token_type token_number, reduction_token, error_frame_token;
  int input_code;
  int input_value;
  int line, column;
  int ssx, sn, error_frame_ssx;
  int drt, dssx, dsn;
  int ss[128];
  int vs[128];
  int ag_ap;
  const char *error_message;
  char read_flag;
  char exit_flag;
  cint input_context;
  cint cs[128];
  int bts[128], btsx;
  int (* const  *gt_procs)(void);
  int (* const *r_procs)(void);
  int (* const *s_procs)(void);
  unsigned char * pointer;
  unsigned char * la_ptr;
  const unsigned char *key_sp;
  int save_index, key_state;
  int ag_error_depth, ag_min_depth, ag_tmp_depth;
  int ag_rss[2*128], ag_lrss;
  char ag_msg[82];
  const  int *ag_dtl;
  int ag_dsn;
  int ag_resynch_active;
} cf_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_cf(void);
void cf(void);

int cf_value(void);
#endif