view anagram/guisupport/conflicttrc.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
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
 * See the file COPYING for license and usage terms.
 *
 * conflicttrc.h
 */

#ifndef CONFLICTTRC_H
#define CONFLICTTRC_H

#include <stdio.h>
#include "port.h"

class AgString; // from agstring.h
#include "dc.h"
#include "tsd.h"


class rule_stack_dc : public dc {
public:
  tsd *parser_stack;

  static MenuOption *auxTable[];
  virtual MenuOption **getAuxWinMenu(void) { return auxTable; }

  rule_stack_dc(tsd *, unsigned, const AgString);
  rule_stack_dc(rule_stack_dc &x) : dc(x), parser_stack(x.parser_stack) {}
  ~rule_stack_dc(void) { delete_tsd(parser_stack); }

  virtual void getLine(unsigned) const;
  virtual void synchCursor(unsigned) const;

  struct item {
    unsigned rule;
    unsigned index;
    item(tsd *, unsigned ln);
  };

  virtual item getItem(unsigned) const;
  virtual unsigned state(unsigned);
  virtual unsigned token(unsigned);

  virtual dc_ref expansion_chain(unsigned ln);
  virtual dc_ref expansion_rules(unsigned ln);
  virtual dc_ref keywords(unsigned ln);
  virtual dc_ref productions(unsigned ln);
  virtual dc_ref rule_context(unsigned ln);
  virtual dc_ref set_elements(unsigned ln);
  virtual dc_ref state_definition(unsigned ln);
  virtual dc_ref state_expansion(unsigned ln);
  virtual dc_ref usage(unsigned ln);

  virtual int expansion_chain_ok(unsigned ln);
  virtual int expansion_rules_ok(unsigned ln);
  virtual int keywords_ok(unsigned ln);
  virtual int productions_ok(unsigned ln);
  virtual int rule_context_ok(unsigned ln); // { return ln != 0; }
  virtual int set_elements_ok(unsigned ln);
  virtual int usage_ok(unsigned ln);

};

dc_ref  build_conflict_trace(int s, int t, int f);
dc_ref  build_et_window(void);
dc_ref  build_red_trace(int, int,int);
dc_ref  conflict_red_trace(int s, int t, int f);
dc_ref  new_item_stack_kernel(dc_ref d, tsd *isl);
dc_ref  problem_states_window(int sn, int fn, int fx, int ct);
dc_ref  set_up_stack_window(AgString);

tsd     *build_et(FILE *f);

#endif /* CONFLICTTRC_H */