bool RtfGenerator::initTheme(const string& themePath) { bool result = CodeGenerator::initTheme(themePath); styleTagOpen.push_back(getOpenTag(STANDARD, docStyle.getDefaultStyle())); styleTagOpen.push_back(getOpenTag(STRING, docStyle.getStringStyle())); styleTagOpen.push_back(getOpenTag(NUMBER, docStyle.getNumberStyle())); styleTagOpen.push_back(getOpenTag(SL_COMMENT, docStyle.getSingleLineCommentStyle())); styleTagOpen.push_back(getOpenTag(ML_COMMENT,docStyle.getCommentStyle())); styleTagOpen.push_back(getOpenTag(ESC_CHAR, docStyle.getEscapeCharStyle())); styleTagOpen.push_back(getOpenTag(DIRECTIVE, docStyle.getDirectiveStyle())); styleTagOpen.push_back(getOpenTag(DIRECTIVE_STRING, docStyle.getDirectiveStringStyle())); styleTagOpen.push_back(getOpenTag(LINENUMBER, docStyle.getLineStyle())); styleTagOpen.push_back(getOpenTag(SYMBOL, docStyle.getSymbolStyle())); styleTagClose.push_back(getCloseTag(docStyle.getDefaultStyle())); styleTagClose.push_back(getCloseTag(docStyle.getStringStyle())); styleTagClose.push_back(getCloseTag(docStyle.getNumberStyle())); styleTagClose.push_back(getCloseTag(docStyle.getSingleLineCommentStyle())); styleTagClose.push_back(getCloseTag(docStyle.getCommentStyle())); styleTagClose.push_back(getCloseTag(docStyle.getEscapeCharStyle())); styleTagClose.push_back(getCloseTag(docStyle.getDirectiveStyle())); styleTagClose.push_back(getCloseTag(docStyle.getDirectiveStringStyle())); styleTagClose.push_back(getCloseTag(docStyle.getLineStyle())); styleTagClose.push_back(getCloseTag(docStyle.getSymbolStyle())); return result; }
void PangoGenerator::initOutputTags() { openTags.push_back ( "" ); openTags.push_back ( getOpenTag ( docStyle.getStringStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getNumberStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getSingleLineCommentStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getCommentStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getEscapeCharStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getPreProcessorStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getPreProcStringStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getLineStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getOperatorStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getInterpolationStyle() ) ); closeTags.push_back ( "" ); for (unsigned int i=1; i<NUMBER_BUILTIN_STATES; i++ ) { closeTags.push_back ( "</span>" ); } }
void SVGGenerator::initOutputTags(){ openTags.push_back ( "" ); openTags.push_back ( getOpenTag ( STY_NAME_STR ) ); openTags.push_back ( getOpenTag ( STY_NAME_NUM ) ); openTags.push_back ( getOpenTag ( STY_NAME_SLC ) ); openTags.push_back ( getOpenTag ( STY_NAME_COM ) ); openTags.push_back ( getOpenTag ( STY_NAME_ESC ) ); openTags.push_back ( getOpenTag ( STY_NAME_DIR ) ); openTags.push_back ( getOpenTag ( STY_NAME_DST ) ); openTags.push_back ( getOpenTag ( STY_NAME_LIN ) ); openTags.push_back ( getOpenTag ( STY_NAME_SYM ) ); openTags.push_back ( getOpenTag ( STY_NAME_IPL ) ); closeTags.push_back ( "" ); for (unsigned int i=1;i<NUMBER_BUILTIN_STATES; i++ ) { closeTags.push_back ( "</tspan>" ); } }
AnsiGenerator::AnsiGenerator() : CodeGenerator(ANSI) { styleTagOpen.push_back(""); styleTagOpen.push_back(getOpenTag("00", "31")); //str styleTagOpen.push_back(getOpenTag("00", "34"));//number styleTagOpen.push_back(getOpenTag("00", "34"));//sl comment styleTagOpen.push_back(getOpenTag("00", "34"));//ml comment styleTagOpen.push_back(getOpenTag("00", "35"));//escapeChar styleTagOpen.push_back(getOpenTag("00", "35"));//directive styleTagOpen.push_back(getOpenTag("00", "31"));//directive string styleTagOpen.push_back(getOpenTag("00", "30"));//linenum styleTagOpen.push_back(getOpenTag("00", "00"));//symbol styleTagClose.push_back(""); for (int i=1;i<NUMBER_BUILTIN_STYLES; i++) { styleTagClose.push_back("\033[m"); } newLineTag = "\n"; spacer = " "; }
void XmlGenerator::initOutputTags(){ openTags.push_back ( getOpenTag ( STY_NAME_STD ) ); openTags.push_back ( getOpenTag ( STY_NAME_STR ) ); openTags.push_back ( getOpenTag ( STY_NAME_NUM ) ); openTags.push_back ( getOpenTag ( STY_NAME_SLC ) ); openTags.push_back ( getOpenTag ( STY_NAME_COM ) ); openTags.push_back ( getOpenTag ( STY_NAME_ESC ) ); openTags.push_back ( getOpenTag ( STY_NAME_DIR ) ); openTags.push_back ( getOpenTag ( STY_NAME_DST ) ); openTags.push_back ( getOpenTag ( STY_NAME_LIN ) ); openTags.push_back ( getOpenTag ( STY_NAME_SYM ) ); closeTags.push_back ( getCloseTag ( STY_NAME_STD ) ); closeTags.push_back ( getCloseTag ( STY_NAME_STR ) ); closeTags.push_back ( getCloseTag ( STY_NAME_NUM ) ); closeTags.push_back ( getCloseTag ( STY_NAME_SLC ) ); closeTags.push_back ( getCloseTag ( STY_NAME_COM ) ); closeTags.push_back ( getCloseTag ( STY_NAME_ESC ) ); closeTags.push_back ( getCloseTag ( STY_NAME_DIR ) ); closeTags.push_back ( getCloseTag ( STY_NAME_DST ) ); closeTags.push_back ( getCloseTag ( STY_NAME_LIN ) ); closeTags.push_back ( getCloseTag ( STY_NAME_SYM ) ); }
void CodeGenerator::processRootState() { if (readAfterEOF && in!=&cin){ in->seekg (0, ios::end); // output the last few lines or the complete file if not too big if (in->tellg()>51200) { in->seekg (-512, ios::end); // output complete lines, ignore first line fragment in->ignore(512, '\n'); } else { in->seekg (0, ios::beg); // output complete file } } string line; size_t i=0; bool tagOpen=false; while (true) { if (!getline(*in, line)) { // imitate tail bahaviour, continue to read after EOF if (readAfterEOF) { out->flush(); in->clear(); #ifdef WIN32 Sleep(250); #else sleep(1); #endif } else { //todo hier position merken, in der gui periodisch den dateizeiger auf diesen wert setzen und den neuen code einlesen break; } } else { i=0; size_t seqEnd=string::npos; while (i <line.length() ) { if (line[i]==0x1b) { // fix grep --colour .[K (1b 5b 4b) sequences if (line.length()>i+2 && line[i+2]==0x4b){ seqEnd=i+2; } else { seqEnd=line.find_first_of('m', i+1); //TODO vor ; das hier anfangen xterm: ^[]0;~^G^M^M // http://www.mit.edu/afs/athena/system/x11r4/src/mit/clients/xterm/ctlseq2.txt if (seqEnd==string::npos) { if (line[i+1]==']') seqEnd=line.find(0x07, i+1); } if (seqEnd==string::npos) seqEnd=line.find(';', i+1); if (seqEnd==string::npos) seqEnd=line.find('h', i+1); if (!ignoreFormatting && seqEnd!=string::npos) { if (!elementStyle.isReset()){ *out <<getCloseTag(); tagOpen=false; } parseSequence(line, i, seqEnd); if (!elementStyle.isReset()) { *out <<getOpenTag(); tagOpen=true; } } } i= 1+ ((seqEnd!=string::npos)?seqEnd:i); } else { *out << maskCharacter(line[i]); ++i; } } *out << newLineTag; } } if (tagOpen){ *out <<getCloseTag(); } out->flush(); }
string PangoGenerator::getKeywordOpenTag ( unsigned int styleID ) { return getOpenTag (docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) ); }
string AnsiGenerator::getMatchingOpenTag(unsigned int styleID) { return (styleID)?getOpenTag("00", "32", ""):getOpenTag("00", "33"); }
bool HtmlGenerator::initTheme(const string& themePath) { bool result = CodeGenerator::initTheme(themePath); styleTagOpen.push_back(""); if (useInlineCSS){ styleTagOpen.push_back(getOpenTag(docStyle.getStringStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getNumberStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getSingleLineCommentStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getCommentStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getEscapeCharStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getDirectiveStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getDirectiveStringStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getLineStyle())); styleTagOpen.push_back(getOpenTag(docStyle.getSymbolStyle())); } else { styleTagOpen.push_back(getOpenTag("str")); styleTagOpen.push_back(getOpenTag("num")); styleTagOpen.push_back(getOpenTag("slc")); styleTagOpen.push_back(getOpenTag("com")); styleTagOpen.push_back(getOpenTag("esc")); styleTagOpen.push_back(getOpenTag("dir")); styleTagOpen.push_back(getOpenTag("dstr")); styleTagOpen.push_back(getOpenTag("line")); styleTagOpen.push_back(getOpenTag("sym")); } styleTagClose.push_back(""); for (int i=1;i<NUMBER_BUILTIN_STYLES; i++) { styleTagClose.push_back("</span>"); } return result; }
string HtmlGenerator::getMatchingOpenTag(unsigned int styleID){ if (useInlineCSS){ return getOpenTag(docStyle.getKeywordStyle(langInfo.getKeywordClasses()[styleID])); } return getOpenTag(langInfo.getKeywordClasses()[styleID]); }
string ODTGenerator::getKeywordOpenTag ( unsigned int styleID ) { return getOpenTag ( currentSyntax->getKeywordClasses() [styleID] ); }
string RtfGenerator::getKeywordOpenTag ( unsigned int styleID ) { return getOpenTag ( KEYWORD+styleID, docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) ); }
void RtfGenerator::initOutputTags ( ) { openTags.push_back ( getOpenTag ( STANDARD, docStyle.getDefaultStyle() ) ); openTags.push_back ( getOpenTag ( STRING, docStyle.getStringStyle() ) ); openTags.push_back ( getOpenTag ( NUMBER, docStyle.getNumberStyle() ) ); openTags.push_back ( getOpenTag ( SL_COMMENT, docStyle.getSingleLineCommentStyle() ) ); openTags.push_back ( getOpenTag ( ML_COMMENT,docStyle.getCommentStyle() ) ); openTags.push_back ( getOpenTag ( ESC_CHAR, docStyle.getEscapeCharStyle() ) ); openTags.push_back ( getOpenTag ( DIRECTIVE, docStyle.getPreProcessorStyle() ) ); openTags.push_back ( getOpenTag ( DIRECTIVE_STRING, docStyle.getPreProcStringStyle() ) ); openTags.push_back ( getOpenTag ( LINENUMBER, docStyle.getLineStyle() ) ); openTags.push_back ( getOpenTag ( SYMBOL, docStyle.getOperatorStyle() ) ); openTags.push_back ( getOpenTag ( STRING_INTERPOLATION, docStyle.getInterpolationStyle()) ); closeTags.push_back ( getCloseTag ( docStyle.getDefaultStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getStringStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getNumberStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getSingleLineCommentStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getCommentStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getEscapeCharStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getPreProcessorStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getPreProcStringStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getLineStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getOperatorStyle() ) ); closeTags.push_back ( getCloseTag ( docStyle.getInterpolationStyle() ) ); }
string XmlGenerator::getKeywordOpenTag ( unsigned int styleID ) { return getOpenTag ( langInfo.getKeywordClasses() [styleID] ); }
string RtfGenerator::getMatchingOpenTag(unsigned int styleID){ return getOpenTag(KEYWORD+styleID, docStyle.getKeywordStyle(langInfo.getKeywordClasses()[styleID])); }