view anagram/agcore/token.h @ 5:7661c1604e49

Add additional operator delete calls gcc 10 asked for.
author David A. Holland
date Mon, 30 May 2022 23:32:56 -0400
parents 13d2b8934445
children 607e3be6bad8
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.
 *
 * token.h
 */

#ifndef TOKEN_H
#define TOKEN_H

#include "register.h"
class Rule;


struct token_number_map;

class Token : public ObjectRegister<token_number_map> {
public:
  Token() {}
  Token(int x);
  Token(const Token &t);
  static Token create();
  static const int first;
  static void reset();
  class Map;
  friend class Map;
  int isLeadingToken(const Token) const;
  int isExpansionToken(const Token) const;
  int isExpansionRule(const Rule) const;
  Token leadingToken(int) const;
  Token follower(int) const ;
  Rule expansionRule(int) const;
  Rule rule(int) const;

  class Map {
  public:
    token_number_map &operator [] (unsigned x);
  };
};

extern Token::Map map_token_number;

#include "keyword.h"
#include "symbol.h"
#include "tree.h"

struct token_number_map {
  AgArray<Rule> ruleList;
  AgArray<Token> followerList;
  AgArray<Rule> expansionRuleList;
  AgArray<Token> leadingTokenList;
  //unsigned key;
  Keyword key;
  Symbol token_name;
  ParseTree parse_tree;
  unsigned
    vp_prod_number,
    value_type,
    token_set_id,
    part_number,
    precedence_level;
  unsigned sticky : 1;
  unsigned zero_length_flag : 1;
  unsigned non_terminal_flag : 1;
  unsigned sem_det_flag : 1;
  unsigned fine_structure: 1;
  unsigned left_associative: 1;
  unsigned right_associative: 1;
  unsigned rp_arg: 1;
  unsigned pure: 1;
  unsigned junky: 1;
  unsigned reserve: 1;
  unsigned reserved_word: 1;
  unsigned subgrammar: 1;
  unsigned lexeme: 1;
  unsigned lexical: 1;
  unsigned immediate_action: 1;
  unsigned operatorCandidate: 1;
  unsigned disregard: 1;

  token_number_map();
  int operator < (const token_number_map &t) const {
    return token_name < t.token_name;
  }
};

#endif /* TOKEN_H */