stack.cpp

来自「这是一个lr文法分析器」· C++ 代码 · 共 55 行

CPP
55
字号
// stack.cpp: implementation of the stack class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "lr.h"
#include "stack.h"
#include "cc.h"


#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

stack::stack()
{
	c.st[0]='#';
	c.st[1]='\0';
	c.con[0]='0';
	c.con[1]='\0';
	topst=1;
	topcon=1;
}

stack::~stack()
{

}

void stack::pop(){
	topst--;
	topcon--;
	c.con[topst]='\0';
	c.con[topcon]='\0';
}

void stack::pushst(char *ch, int k){
	c.st[topst]=ch[k];

	topst++;
    c.st[topst]='\0';
}

void stack::pushcon(char *condi, int i){
	c.con[topcon]=condi[i];

	topcon++;
	c.con[topcon]='\0';
}

⌨️ 快捷键说明

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