analyzetable.cpp

来自「LL1通用语法分析器」· C++ 代码 · 共 39 行

CPP
39
字号
/************************************************************************                        Copyright IBMTC Written by Xinxi Wang**************************************************************************/#include "AnalyzeTable.h"#include <iostream>using namespace std;/** * @brief 获取索引所对应的产生式 * @param index 索引 * @return 索引对应的产生式 */Production AnalyzeTable::getProduction (const Index& index ) constthrow(ProductionNotExists){    TableType::const_iterator it = table.find(index);    if(it == table.end())        throw ProductionNotExists();    else         return Production(it->second);}/** * @brief 添加索引所对应的产生式 * @param  index 索引 * @param  production 索引对应的产生式 */void AnalyzeTable::addProduction (const Index& index,                                   const Production& production ) throw(ProductionAlreadyExists) {    if(table.count(index) != 0)        throw ProductionAlreadyExists();        table[index] = production;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?