📄 getfirst.cpp
字号:
#include "parse.h"
#include "read.h"
#include "make.h"
extern vecNter nonterminals;
vector<string> makeFirst(vector<string> vecstr )
{
vector<string> first;int i;
for( i = 0;i < (int)vecstr.size();i++)
{
if( findIndex(vecstr[i] ) == -1 )
{
if ( !hasexisted( first,vecstr[i] ) )
first.push_back(vecstr[i]);
break;
}//if
else
{
int index = findIndex( vecstr[i] );
add( nonterminals[index].first,first );
if( !hasexisted( nonterminals[ index ].first, "ε" ) )break;
}//else
}//for
if( i == vecstr.size() )first.push_back("ε");
return first;
}
void add(vector<string> &v1,vector<string> &v2)
{
for(int i = 0;i <(int) v1.size();i++)
if( v1[i] != "ε" && !hasexisted(v2,v1[i]) )v2.push_back(v1[i]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -