?? tool.cpp
字號:
/*
Some tool functions
using very simple linear algorithm
*/
#include "global.h"
void print(list<string>& l)
{
list<string>::iterator iter = l.begin();
while(iter != l.end())
cout << *iter++ << " ";
cout << endl;
}
void removeDup(list<string>& l)
{
string hold;
list<string>::iterator sIter,pIter;
pIter = l.begin();
while(pIter != l.end()){
hold = *pIter;
sIter = pIter;
sIter++;
while(sIter != l.end())
if(*sIter == hold)
l.erase(sIter++);
else sIter++;
pIter++;
}
}
bool isIn(string target,list<string>& s) // to decide whether a symbol is a terminal symbol or
// non-terminal symbol
{ // or for something judgement in later procession
// sequencial search , only for small instance :)
// I am not quite sophlicated in algorithm
list<string>::iterator iter = s.begin();
while(iter != s.end()){
if(*iter == target)
return true;
iter++;
}
return false;
}
void listToString(string& s,list<string> l)
{
// the string has fixed ...
list<string>::iterator iter;
for(iter = l.begin();iter != l.end();iter++){
s.append(*iter); // append to the string
s.append(" ");
}
}
void noRightReserve()
{
// holding for later usage
cout << "***********************************" << endl;
cout << "* LL(1) parsing version 0.5 " << endl;
cout << "***********************************" << endl;
cout << "\n\n\n*Me aNd FlOwEr ArE LiViG HaPPiLY Now\n";
cout << "* AnD HoW MuCh We LoVe ThIs WoRlD\n";
cout << "* Mathematics Worm Association" << endl;
cout << " * Math Frog 6.8.2005 " << endl;
cout << " @ No Right Reserve" << endl;
cout << "***********************************" << endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -