Mercurial > ~dholland > hg > ag > index.cgi
view anagram/agcore/tree.cpp @ 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. * * tree.cpp */ #include "assert.h" #include "csexp.h" #include "tree.h" //#define INCLUDE_LOGGING #include "log.h" int parse_tree_map::operator < (const parse_tree_map &t) const { LOGSECTION_OFF("parse_tree_map::operator <"); LOGV(expression != 0 ? expression->asString() : AgString()); LOGV(t.expression != 0 ? t.expression->asString() : AgString()); if (expression && t.expression) { return *expression < *t.expression; } if (expression == 0) { return t.expression != 0; } return 0; } ParseTree::ParseTree(unsigned x) : KeyedObjectRegister<parse_tree_map>(x) {} ParseTree::ParseTree(const ParseTree &t) : KeyedObjectRegister<parse_tree_map>(t) {} ParseTree::ParseTree(CharSetExpression *x) : KeyedObjectRegister<parse_tree_map>(parse_tree_map(x)) { LOGSECTION("ParseTree::ParseTree"); LOGV(index) LCV(x == 0 ? AgString() : x->asString()); LOGV((int) x) LCV((int) descriptor->expression); if (descriptor->expression != x) { delete x; } } parse_tree_map &ParseTree::Map::operator [] (unsigned x) { assert(x < ParseTree::descriptorList.size()); return ParseTree::descriptorList[x]; } void ParseTree::reset() { LOGSECTION("ParseTree::reset"); int n = descriptorList.size(); while (n-- > 0) { delete descriptorList[n].expression; } KeyedObjectRegister<parse_tree_map>::reset(); //descriptorList.push(parse_tree_map()); ParseTree parseTree((CharSetExpression *) 0); } parse_tree_map::parse_tree_map() : expression(0), char_set(0) { // Nothing to do } parse_tree_map::parse_tree_map(CharSetExpression *x) : expression(x), char_set(0) { LOGSECTION("parse_tree_map::parse_tree_map"); LOGV((int) this) LCV((int) x); } ParseTree::Map map_parse_tree;