Children mainParse(I& be, I& en, Pos& pos) { Children ret; while(be != en) { eatWhitespaceComment(be, en, pos); if(test(be, en, "<{{")) { ret.push_back(std::move(parseC(be, en, pos))); } else if(test(be, en, '<')) { ret.push_back(std::move(parseNode(be, en, pos))); } else if(test(be, en, '>')) { eat(be, '>', pos); break; } else { I iter; TNodeType type; if(!test(be, en, "&{{") && *be == '&') { iter = eatUntil(be, en, "\n", pos); /*for(iter = be; !test(iter, en, '\n') && !test(iter, en, "//"); increment(iter, pos)) { } if(test(be, en, "//")) { eatWhitespaceComment(be, en, pos); }*/ type = TNodeType::SingleCppLine; } else { iter = eatUntil(be, en, "\n>", pos); for(iter = be; !test(iter, en, '\n') && !test(iter, en, "//") && !test(iter, en, '>'); increment(iter, pos)) { } if(test(be, en, "//")) { eatWhitespaceComment(be, en, pos); } type = TNodeType::Text; } auto posCopy = pos; //std::cout<<"||| "<<std::string(be, iter)<<std::endl; ret.push_back( std::make_unique<TNode>(std::string(be, iter), posCopy, type ) ); be = iter; char iterC = *iter; eat(be, iterC, pos); if(iterC == '>') { break; } } eatWhitespaceComment(be, en, pos); } return ret; }
NPtr parseHeader(I& be, I& en, Pos& pos) { eatWhitespaceComment(be, en, pos); auto beCopy = be; if(test(beCopy, en, "<{{")) { return parseC(be, en, pos); } else { return std::make_unique<CNode>("", pos); } }
Steps::Steps( const char* vlist, const char* clist, const char* elist, int nIn ) : vstepsLen( 1 ), cstepsLen( 1 ), estepsLen( 1 ), seatSteps( NULL ), v( 0 ), c( 0 ), e( -1 ), n( nIn ) { if ( vlist ) { parseV( vlist ); } else { vsteps = (int*)malloc( sizeof(int) ); vstepsLen = 0; } if ( clist ) { parseC( clist ); } else { csteps = (int*)malloc( sizeof(int) ); cstepsLen = 0; } if ( elist ) { parseE( elist ); } else { esteps = (float*)malloc( sizeof(float) ); estepsLen = 0; } }
// ======================>>> vTextEditor::paintLine <<<===================== void vedTextEditor::paintLine(char* linout, int lineStart, int hiStart, int hiLast, long lineNum) { // paint a line. // linout: the line to output with tabs converted to spaces, etc. // lineStart: where to begin printing the line (for hoiz. scrolling) // hiStart, hiLast: reverse text attribute // lineNum: the real line number in the buffer this is. // This version overrides the original to handle syntax highlighting ChrAttr attrs[MAX_LINE+1]; // for attributes int wasComment = 0; int linlen = strlen(linout); if (linlen <= 0) // only draw if there! return; for (int ix = 0 ; ix <= MAX_LINE ; ++ix) // assume normal attrs[ix] = stdColor[curColors]; // Parse the line for syntax if (GetFileType() == CPP) // if a C file, parse wasComment = parseC(linout,attrs,lineNum,CPP); else if (GetFileType() == Java) // if a Java file, parse wasComment = parseC(linout,attrs,lineNum,Java); else if (GetFileType() == Perl) // if a Perl file, parse wasComment = parseC(linout,attrs,lineNum,Perl); else if (GetFileType() == Fortran) // if a Fortran file, parse wasComment = parseFortran(linout,attrs,lineNum); else if (GetFileType() == HTML) // if a HTML file, parse wasComment = parseHTML(linout,attrs,lineNum); else if (GetFileType() == TeX) // if a TeX file, parse wasComment = parseTeX(linout,attrs,lineNum); else if (GetFileType() == gccError || GetFileType() == bccError) { int ig = 0; while (isSpace(linout[ig])) ++ig; if (linout[ig] == '>' || linout[ig] == '+') { if (linout[ig] == '+') attrs[ig++] = dirColor[curColors]; while (linout[ig]) attrs[ig++] = keyColor[curColors]; } else if (linout[ig] == '!' || linout[ig] == '*') { if (linout[ig] == '*') attrs[ig++] = dirColor[curColors]; while (linout[ig]) attrs[ig++] = constColor[curColors]; } } // Now fill in highlight attributes for (int ih = 0 ; linout[ih] != 0 ; ++ih) { if (ih >= hiStart && ih < hiLast) attrs[ih] = getHighlight(); // override syntax colors } if ( ((videApp*)theApp)->isBP(((VCmdWindow*)_parent)->GetFileName(), lineNum)) { for (int ij = 0 ; linout[ij] != 0 ; ++ij) { attrs[ij] = ChBlackOnBG | ChYellow; } } if ( (((videApp*)theApp)->getBreakPoints())-> checkIfCurPC(((VCmdWindow*)_parent)->GetFileName(), lineNum)) { for (int ij = 0 ; linout[ij] != 0 ; ++ij) { attrs[ij] = ChBlackOnBG | ChRed; } } // new - V version 1.23 - added DrawAttrsText DrawAttrsText((const char*)&linout[lineStart], (const ChrAttr*)&attrs[lineStart]); // old code - dumb, slow way to do this // for (int ixx = lineStart ; linout[ixx] != 0 ; ++ixx) // DrawChar(linout[ixx],attrs[ixx]); }