Mercurial > ~dholland > hg > ag > index.cgi
view anagram/agcore/symbol.cpp @ 8:ec2b657edf13
Add explicit lint-comment-style fallthrough annotations.
GCC now assumes that if you don't have these you're making a mistake,
which is annoying.
XXX: This changeset updates the AG output files only (by hand) and is
XXX: abusive - rebuilding them will erase the change. However, I need
XXX: to get things to build before I can try to get AG to issue the
XXX: annotations itself, so this seems like a reasonable expedient.
author | David A. Holland |
---|---|
date | Mon, 30 May 2022 23:51:43 -0400 |
parents | 607e3be6bad8 |
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. * * symbol.cpp */ #include "symbol.h" #include "stacks.h" //#define INCLUDE_LOGGING #include "log.h" Symbol::Symbol(unsigned x) : KeyedObjectRegister<SymbolDescriptor>(x) {} Symbol::Symbol(const Symbol &t) : KeyedObjectRegister<SymbolDescriptor>(t) {} Symbol::Symbol(const char *x) : KeyedObjectRegister<SymbolDescriptor>(SymbolDescriptor(x)) { // Nothing to do } void Symbol::operator = (const Symbol &t) { KeyedObjectRegister<SymbolDescriptor>::operator = (t); } void Symbol::reset() { LOGSECTION("Symbol::reset"); KeyedObjectRegister<SymbolDescriptor>::reset(); //descriptorList.push(SymbolDescriptor()); Symbol(""); LOGV(descriptorList.size()) LCV(Symbol()->string); } Symbol Symbol::sorted(int x) { LOGSECTION("Symbol::sorted"); LOGV(x); Symbol symbol = tree[x]; LOGV(symbol) LCV(symbol->string); return symbol; } Symbol Symbol::create() { LOGSECTION("Symbol::create"); tss(); LOGV(string_base); Symbol symbol(string_base); rcs(); LOGV(symbol); return symbol; } Symbol add_string_dict(const char *s, Symbol::Dict &d) { return d.add_string(s); } Symbol::Map map_token_name; Symbol::Dict tkn_dict; SymbolDescriptor &Symbol::Map::operator [] (unsigned x) { LOGSECTION("Symbol::Map::operator []"); LOGV(x) LCV(descriptorList.size()); assert(x < Symbol::descriptorList.size()); return Symbol::descriptorList[x]; } Symbol Symbol::Dict::add_string(const char *s) { return Symbol(s); } SymbolDescriptor::SymbolDescriptor() : token_list_id(0) { // Nothing to do } SymbolDescriptor::SymbolDescriptor(const char *s) : string(s), token_list_id(0) { // Nothing to do } int SymbolDescriptor::operator < (const SymbolDescriptor &d) const { return string < d.string; }