⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grammartitleproduct.cpp

📁 compiler principle how to ananilyze
💻 CPP
字号:
// GrammarTitleProduct.cpp: implementation of the GrammarTitleProduct class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SymbolTable.h"
#include "assert.h"

#include "GrammarTitleProduct.h"


extern SymbolTable symbol_table;


GrammarTitleProduct::GrammarTitleProduct()
{ }

int GrammarTitleProduct::getStartSymbolIndex() const {

	assert(line.size() == (countLeft + 1));
	return line[countLeft]; 
}


void GrammarTitleProduct::append_Right(int symbolTableIndex) {

	line.push_back(symbolTableIndex);
}

string GrammarTitleProduct::display() const {
	
	int size = line.size();
	if (size <=0 ) return "";
	
	string str;
	int i =0;
	for(; i < countLeft; ++i) {
		str += " ";
		const SymbolEntry& se = symbol_table[line[i]];
		str += se.display();
	}

	str += " ";
	str += SymbolEntry::p_LEFT_BRACKET;

	for(; i<size; ++i) {
		str += " ";
		const SymbolEntry& se = symbol_table[line[i]];
		str += se.display();
	}

	str += " ";
	str += SymbolEntry::p_RIGHT_BRACKET;
	
	str += " ";
	str += SymbolEntry::c_DELIMITER;

	return str;
}

⌨️ 快捷键说明

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