本文整理汇总了C++中Tokenizer::skipToken方法的典型用法代码示例。如果您正苦于以下问题:C++ Tokenizer::skipToken方法的具体用法?C++ Tokenizer::skipToken怎么用?C++ Tokenizer::skipToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tokenizer
的用法示例。
在下文中一共展示了Tokenizer::skipToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Expression1::parseExpression()
{
curToken=t.getToken();
trm->parseTrm();
if(curToken == 22) {
altNum=2;
t.skipToken();
parseExpression();
}
else if(curToken == 23) {
altNum=3;
t.skipToken();
parseExpression();
}
}
示例2: parseAssign
void Assign::parseAssign()
{
curToken=t.getToken();
#ifdef ENABLE_DEBUG_PARSE
cout<<"curToken in parseAssign-1 "<<curToken<<endl;
#endif
//Check if current Token is an Identifier, Integer, =, +, - or ;
//and call appropriate function
if(curToken == 32) { exp.parseExpression(); }
else if(curToken == 31) { exp.parseExpression(); }
else if(curToken == 14) { t.skipToken(); parseAssign(); }
else if(curToken == 22) { t.skipToken(); parseAssign(); }
else if(curToken == 23) { t.skipToken(); parseAssign(); }
else if(curToken == 12) { t.skipToken(); }
else { cout<<"Error-while parsing "<<endl; exit(1); }
}
示例3: parseIN
void IN::parseIN()
{
curToken=t.getToken();
while(curToken != 12){
idl.parseIdListForSS();
curToken=t.getToken();
t.skipToken();
}
}
示例4: printProgram
void Program::printProgram() {
t.setIndex(-1);
t.skipToken();
curToken=t.getToken();
//----------------------------------------------------------------//
if(curToken == 1) {
cout<<"program"<<endl;
t.skipToken();
while(curToken != 2) {
ds.printDS();
t.skipToken();
curToken=t.getToken();
}
}
else {
cout<<"error 1"<<endl;
exit(1);
}
cout<<endl;
//----------------------------------------------------------------//
if(curToken == 2) {
cout<<"begin"<<endl;
id.insertSpace();
t.skipToken();
while(curToken != 3) {
ss.printSS();
t.skipToken();
curToken=t.getToken();
}
}
else {
cout<<"error 2"<<endl;
exit(1);
}
cout<<endl;
//----------------------------------------------------------------//
if(curToken == 3) {
cout<<"end"<<endl;
}
else {
cout<<"error 3"<<endl;
}
}
示例5: parseCondition
void Condition::parseCondition()
{
curToken=t.getToken();
if(curToken == 20) {
altNum=1;
comp.parseCompare();
}
else if(curToken == 15) {
altNum=2;
t.skipToken();
parseCondition();
}
else if(curToken == 16) {
t.skipToken();
parseCondition();
curToken=t.getToken();
if(curToken == 18){
altNum=3;
}
else if(curToken == 19){
altNum=4;
}
else{
cout<<"Error-expecting && or ||"<<endl;
exit(0);
}
t.skipToken();
parseCondition();
curToken=t.getToken();
if(curToken == 17) {
t.skipToken();
}
else {
cout<<"Error-expecting ]"<<endl;
exit(0);
}
}
else {
cout<<"Error. Exiting"<<endl;
exit(0);
}
}
示例6: parseDecl
void Decl::parseDecl()
{
curToken=t.getToken();
if(curToken != 4)
{
cout<<"Error - expecting int"<<endl;
exit(1);
}
t.skipToken();
idl.parseIdListForDS();
}
示例7: parseCompare
void Compare::parseCompare()
{
curToken=t.getToken();
if(curToken != 20)
{
cout<<"error in parseCompare-Compare.h"<<endl;
exit(0);
}
t.skipToken();
op.parseOperator();
compOp.parseCompareOperator();
op.parseOperator();
curToken=t.getToken();
if(curToken != 21)
{
cout<<"error in parseCompare-Compare.h"<<endl;
exit(0);
}
t.skipToken();
}
示例8: parseExpression
void Expression::parseExpression()
{
curToken=t.getToken();
#ifdef ENABLE_DEBUG_PARSE
cout<<"curToken in parseExpression "<<curToken<<endl;
#endif
altNum=1;
this->getTrmInstance()->parseTrm();
if(curToken == 22) {
altNum=2;
t.skipToken();
parseExpression();
}
else if(curToken == 23) {
altNum=3;
t.skipToken();
parseExpression();
}
}
示例9: parseOUT
void OUT::parseOUT()
{
curToken=t.getToken();
if(curToken == 11){
t.skipToken();
this->getidListInstance()->parseIDListForSS();
}
else {
cout<<"Error-expecting write"<<endl;
exit(0);
}
t.skipToken();
curToken=t.getToken();
if(curToken == 12) {
cout<<"";
}
else {
cout<<"Error-expecting ;"<<endl;
exit(0);
}
}
示例10: parseStmt
void Stmt::parseStmt()
{
curToken=t.getToken();
#ifdef ENABLE_DEBUG_PRINT
cout<<"curToken in parseStmt "<<curToken<<endl;
#endif
if(curToken == 32)
{
altNum=1;
t.skipToken();
#ifdef ENABLE_DEBUG_PRINT
cout<<"calling parseAssign"<<endl;
#endif
assign.parseAssign();
}
else if(curToken == 5)
{
altNum=2;
#ifdef ENABLE_DEBUG_PRINT
cout<<"calling parseIF"<<endl;
#endif
this->getIfInstanceStmt()->parseIF();
}
else if(curToken == 8)
{
altNum=3;
#ifdef ENABLE_DEBUG_PRINT
cout<<"calling parseLoop"<<endl;
#endif
this->getLoopInstanceStmt()->parseLoop();
}
else if(curToken == 10)
{
altNum=4;
#ifdef ENABLE_DEBUG_PRINT
cout<<"calling parseIN"<<endl;
#endif
in.parseIN();
}
else if(curToken == 11)
{
#ifdef ENABLE_DEBUG_PRINT
cout<<"curToken-before calling OUT "<<curToken<<endl;
#endif
altNum=5;
out.parseOUT();
}
}
示例11: parseOperator
void Operator::parseOperator()
{
curToken=t.getToken();
if(curToken==31){
altNum=1;
no=t.intVal();
t.skipToken();
}
else if(curToken==32){
altNum=2;
id.parseIDForSS();
}
else if(curToken==20) {
altNum=3;
t.skipToken();
exp->parseExpression();
curToken=t.getToken();
if(curToken != 21){
cout<<"Error-expecting )"<<endl;
exit(0);
}
t.skipToken();
}
}
示例12: parseIDForSS
ID* ID::parseIDForSS()
{
string idName=t.getIdName();
for(int k=0; k<idCount; k++)
{
if(idName==eIDs[k]->name) {
t.skipToken();
return eIDs[k];
}
else {
cout<<"Error - variable has already been declared"<<endl;
exit(0);
}
}
}
示例13: parseIDListForDS
void idList::parseIDListForDS()
{
curToken=t.getToken();
if(curToken == 13){
t.skipToken();
curToken=t.getToken();
if(curToken == 32){
id.parseIDForDS();
}
else {
cout<<"Error-Expecting an integer value. Exiting"<<endl;
exit(0);
}
}
}
示例14: parseProgram
void Program::parseProgram() {
t.setIndex(-1);
t.skipToken();
curToken=t.getToken();
//----------------------------------------------------------------//
if(curToken == 1) {
t.skipToken();
curToken=t.getToken();
while(curToken != 2) {
ds.parseDS();
t.skipToken();
curToken=t.getToken();
}
}
else {
cout<<"error 1"<<endl;
exit(1);
}
cout<<endl;
//----------------------------------------------------------------
if(curToken == 2) {
t.skipToken();
curToken=t.getToken();
while(curToken != 3) {
ss.parseSS();
t.skipToken();
curToken=t.getToken();
}
}
else {
cout<<"error 2"<<endl;
exit(1);
}
cout<<endl;
//----------------------------------------------------------------//
if(curToken == 3) {
t.skipToken();
curToken=t.getToken();
cout<<"End of Parsing. No errors found"<<endl;
}
else {
cout<<"error 3"<<endl;
exit(1);
}
}
示例15: parse
/* ParseTreeNode::parse
* Parses formatted text data. Current valid formatting is:
* (type) child = value;
* (type) child = value1, value2, ...;
* (type) child = { value1, value2, ... }
* (type) child { grandchild = value; etc... }
* (type) child : inherited { ... }
* All values are read as strings, but can be retrieved as string,
* int, bool or float.
*******************************************************************/
bool ParseTreeNode::parse(Tokenizer& tz)
{
// Get first token
string token = tz.getToken();
// Keep parsing until final } is reached (or end of file)
while (!(S_CMP(token, "}")) && !token.IsEmpty())
{
// Check for preprocessor stuff
if (parser)
{
// #define
if (S_CMPNOCASE(token, "#define"))
{
parser->define(tz.getToken());
token = tz.getToken();
continue;
}
// #if(n)def
if (S_CMPNOCASE(token, "#ifdef") || S_CMPNOCASE(token, "#ifndef"))
{
bool test = true;
if (S_CMPNOCASE(token, "#ifndef"))
test = false;
string define = tz.getToken();
if (parser->defined(define) == test)
{
// Continue
token = tz.getToken();
continue;
}
else
{
// Skip section
int skip = 0;
while (true)
{
token = tz.getToken();
if (S_CMPNOCASE(token, "#endif"))
skip--;
else if (S_CMPNOCASE(token, "#ifdef"))
skip++;
else if (S_CMPNOCASE(token, "#ifndef"))
skip++;
if (skip < 0)
break;
if (token.IsEmpty())
{
wxLogMessage("Error: found end of file within #if(n)def block");
break;
}
}
continue;
}
}
// #include (ignore)
if (S_CMPNOCASE(token, "#include"))
{
tz.skipToken(); // Skip include path
token = tz.getToken();
continue;
}
// #endif (ignore)
if (S_CMPNOCASE(token, "#endif"))
{
token = tz.getToken();
continue;
}
}
// If it's a special character (ie not a valid name), parsing fails
if (tz.isSpecialCharacter(token.at(0)))
{
wxLogMessage("Parsing error: Unexpected special character '%s' in %s (line %d)", CHR(token), CHR(tz.getName()), tz.lineNo());
return false;
}
// So we have either a node or property name
string name = token;
// Check next token to determine what we're doing
string next = tz.peekToken();
// Check for type+name pair
string type = "";
//.........这里部分代码省略.........