diff options
Diffstat (limited to 'src/docparser.cpp')
-rw-r--r-- | src/docparser.cpp | 254 |
1 files changed, 61 insertions, 193 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index 7e34ad0..0a132a8 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1244,34 +1244,34 @@ reparsetoken: switch (Mappers::cmdMapper->map(tokenName)) { case CMD_BSLASH: - children.append(new DocSymbol(parent,DocSymbol::BSlash)); + children.append(new DocSymbol(parent,DocSymbol::Sym_BSlash)); break; case CMD_AT: - children.append(new DocSymbol(parent,DocSymbol::At)); + children.append(new DocSymbol(parent,DocSymbol::Sym_At)); break; case CMD_LESS: - children.append(new DocSymbol(parent,DocSymbol::Less)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Less)); break; case CMD_GREATER: - children.append(new DocSymbol(parent,DocSymbol::Greater)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Greater)); break; case CMD_AMP: - children.append(new DocSymbol(parent,DocSymbol::Amp)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Amp)); break; case CMD_DOLLAR: - children.append(new DocSymbol(parent,DocSymbol::Dollar)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Dollar)); break; case CMD_HASH: - children.append(new DocSymbol(parent,DocSymbol::Hash)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Hash)); break; case CMD_DCOLON: - children.append(new DocSymbol(parent,DocSymbol::DoubleColon)); + children.append(new DocSymbol(parent,DocSymbol::Sym_DoubleColon)); break; case CMD_PERCENT: - children.append(new DocSymbol(parent,DocSymbol::Percent)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Percent)); break; case CMD_QUOTE: - children.append(new DocSymbol(parent,DocSymbol::Quot)); + children.append(new DocSymbol(parent,DocSymbol::Sym_Quot)); break; case CMD_EMPHASIS: { @@ -1488,11 +1488,10 @@ reparsetoken: break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(tokenName,&letter); - if (s!=DocSymbol::Unknown) + DocSymbol::SymType s = DocSymbol::decodeSymbol(tokenName); + if (s!=DocSymbol::Sym_Unknown) { - children.append(new DocSymbol(parent,s,letter)); + children.append(new DocSymbol(parent,s)); } else { @@ -1571,138 +1570,10 @@ static void handleImg(DocNode *parent,QList<DocNode> &children,const HtmlAttribL //--------------------------------------------------------------------------- -DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName,char *letter) -{ - int l=symName.length(); - DBG(("decodeSymbol(%s) l=%d\n",qPrint(symName),l)); - // TODO: replace this with a hash - if (symName=="©") return DocSymbol::Copy; - else if (symName=="™") return DocSymbol::Tm; - else if (symName=="&tm;") return DocSymbol::Tm; // alias for ™ - else if (symName=="®") return DocSymbol::Reg; - else if (symName=="<") return DocSymbol::Less; - else if (symName==">") return DocSymbol::Greater; - else if (symName=="&") return DocSymbol::Amp; - else if (symName=="'") return DocSymbol::Apos; - else if (symName==""") return DocSymbol::Quot; - else if (symName=="‘") return DocSymbol::Lsquo; - else if (symName=="’") return DocSymbol::Rsquo; - else if (symName=="“") return DocSymbol::Ldquo; - else if (symName=="”") return DocSymbol::Rdquo; - else if (symName=="–") return DocSymbol::Ndash; - else if (symName=="—") return DocSymbol::Mdash; - else if (symName=="ß") return DocSymbol::Szlig; - else if (symName==" ") return DocSymbol::Nbsp; - else if (symName=="Æ") return DocSymbol::AElig; - else if (symName=="æ") return DocSymbol::Aelig; - else if (symName=="Γ") return DocSymbol::GrkGamma; - else if (symName=="Δ") return DocSymbol::GrkDelta; - else if (symName=="Θ") return DocSymbol::GrkTheta; - else if (symName=="Λ") return DocSymbol::GrkLambda; - else if (symName=="Ξ") return DocSymbol::GrkXi; - else if (symName=="Π") return DocSymbol::GrkPi; - else if (symName=="Σ") return DocSymbol::GrkSigma; - else if (symName=="Υ") return DocSymbol::GrkUpsilon; - else if (symName=="Φ") return DocSymbol::GrkPhi; - else if (symName=="Ψ") return DocSymbol::GrkPsi; - else if (symName=="Ω") return DocSymbol::GrkOmega; - else if (symName=="α") return DocSymbol::Grkalpha; - else if (symName=="β") return DocSymbol::Grkbeta; - else if (symName=="γ") return DocSymbol::Grkgamma; - else if (symName=="δ") return DocSymbol::Grkdelta; - else if (symName=="ε") return DocSymbol::Grkepsilon; - else if (symName=="ζ") return DocSymbol::Grkzeta; - else if (symName=="η") return DocSymbol::Grketa; - else if (symName=="θ") return DocSymbol::Grktheta; - else if (symName=="ι") return DocSymbol::Grkiota; - else if (symName=="κ") return DocSymbol::Grkkappa; - else if (symName=="λ") return DocSymbol::Grklambda; - else if (symName=="μ") return DocSymbol::Grkmu; - else if (symName=="ν") return DocSymbol::Grknu; - else if (symName=="ξ") return DocSymbol::Grkxi; - else if (symName=="π") return DocSymbol::Grkpi; - else if (symName=="ρ") return DocSymbol::Grkrho; - else if (symName=="σ") return DocSymbol::Grksigma; - else if (symName=="τ") return DocSymbol::Grktau; - else if (symName=="υ") return DocSymbol::Grkupsilon; - else if (symName=="φ") return DocSymbol::Grkphi; - else if (symName=="χ") return DocSymbol::Grkchi; - else if (symName=="ψ") return DocSymbol::Grkpsi; - else if (symName=="ω") return DocSymbol::Grkomega; - else if (symName=="ς") return DocSymbol::Grkvarsigma; - else if (symName=="§") return DocSymbol::Section; - else if (symName=="°") return DocSymbol::Degree; - else if (symName=="′") return DocSymbol::Prime; - else if (symName=="″") return DocSymbol::DoublePrime; - else if (symName=="∞") return DocSymbol::Infinity; - else if (symName=="∅") return DocSymbol::EmptySet; - else if (symName=="±") return DocSymbol::PlusMinus; - else if (symName=="×") return DocSymbol::Times; - else if (symName=="−") return DocSymbol::Minus; - else if (symName=="⋅") return DocSymbol::CenterDot; - else if (symName=="∂") return DocSymbol::Partial; - else if (symName=="∇") return DocSymbol::Nabla; - else if (symName=="√") return DocSymbol::SquareRoot; - else if (symName=="⊥") return DocSymbol::Perpendicular; - else if (symName=="∑") return DocSymbol::Sum; - else if (symName=="∫") return DocSymbol::Integral; - else if (symName=="∏") return DocSymbol::Product; - else if (symName=="∼") return DocSymbol::Similar; - else if (symName=="≈") return DocSymbol::Approx; - else if (symName=="≠") return DocSymbol::NotEqual; - else if (symName=="≡") return DocSymbol::Equivalent; - else if (symName=="∝") return DocSymbol::Proportional; - else if (symName=="≤") return DocSymbol::LessEqual; - else if (symName=="≥") return DocSymbol::GreaterEqual; - else if (symName=="←") return DocSymbol::LeftArrow; - else if (symName=="→") return DocSymbol::RightArrow; - else if (symName=="∈") return DocSymbol::SetIn; - else if (symName=="∉") return DocSymbol::SetNotIn; - else if (symName=="⌈") return DocSymbol::LeftCeil; - else if (symName=="⌉") return DocSymbol::RightCeil; - else if (symName=="⌊") return DocSymbol::LeftFloor; - else if (symName=="⌋") return DocSymbol::RightFloor; - else if (l==6 && symName.right(4)=="uml;") - { - *letter=symName.at(1); - return DocSymbol::Uml; - } - else if (l==8 && symName.right(6)=="acute;") - { - *letter=symName.at(1); - return DocSymbol::Acute; - } - else if (l==8 && symName.right(6)=="grave;") - { - *letter=symName.at(1); - return DocSymbol::Grave; - } - else if (l==7 && symName.right(5)=="circ;") - { - *letter=symName.at(1); - return DocSymbol::Circ; - } - else if (l==8 && symName.right(6)=="tilde;") - { - *letter=symName.at(1); - return DocSymbol::Tilde; - } - else if (l==8 && symName.right(6)=="cedil;") - { - *letter=symName.at(1); - return DocSymbol::Cedil; - } - else if (l==7 && symName.right(5)=="ring;") - { - *letter=symName.at(1); - return DocSymbol::Ring; - } - else if (l==8 && symName.right(6)=="slash;") - { - *letter=symName.at(1); - return DocSymbol::Slash; - } - return DocSymbol::Unknown; +DocSymbol::SymType DocSymbol::decodeSymbol(const QCString &symName) +{ + DBG(("decodeSymbol(%s)\n",qPrint(symName))); + return code_symbol(symName); } //--------------------------------------------------------------------------- @@ -3369,26 +3240,25 @@ int DocIndexEntry::parse() break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); switch (s) { - case DocSymbol::BSlash: m_entry+='\\'; break; - case DocSymbol::At: m_entry+='@'; break; - case DocSymbol::Less: m_entry+='<'; break; - case DocSymbol::Greater: m_entry+='>'; break; - case DocSymbol::Amp: m_entry+='&'; break; - case DocSymbol::Dollar: m_entry+='$'; break; - case DocSymbol::Hash: m_entry+='#'; break; - case DocSymbol::Percent: m_entry+='%'; break; - case DocSymbol::Apos: m_entry+='\''; break; - case DocSymbol::Quot: m_entry+='"'; break; - case DocSymbol::Lsquo: m_entry+='`'; break; - case DocSymbol::Rsquo: m_entry+='\''; break; - case DocSymbol::Ldquo: m_entry+="``"; break; - case DocSymbol::Rdquo: m_entry+="''"; break; - case DocSymbol::Ndash: m_entry+="--"; break; - case DocSymbol::Mdash: m_entry+="---"; break; + case DocSymbol::Sym_BSlash: m_entry+='\\'; break; + case DocSymbol::Sym_At: m_entry+='@'; break; + case DocSymbol::Sym_Less: m_entry+='<'; break; + case DocSymbol::Sym_Greater: m_entry+='>'; break; + case DocSymbol::Sym_Amp: m_entry+='&'; break; + case DocSymbol::Sym_Dollar: m_entry+='$'; break; + case DocSymbol::Sym_Hash: m_entry+='#'; break; + case DocSymbol::Sym_Percent: m_entry+='%'; break; + case DocSymbol::Sym_apos: m_entry+='\''; break; + case DocSymbol::Sym_Quot: m_entry+='"'; break; + case DocSymbol::Sym_lsquo: m_entry+='`'; break; + case DocSymbol::Sym_rsquo: m_entry+='\''; break; + case DocSymbol::Sym_ldquo: m_entry+="``"; break; + case DocSymbol::Sym_rdquo: m_entry+="''"; break; + case DocSymbol::Sym_ndash: m_entry+="--"; break; + case DocSymbol::Sym_mdash: m_entry+="---"; break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected symbol found as argument of \\addindex"); break; @@ -5470,37 +5340,37 @@ int DocPara::handleCommand(const QCString &cmdName) if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," ")); break; case CMD_BSLASH: - m_children.append(new DocSymbol(this,DocSymbol::BSlash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_BSlash)); break; case CMD_AT: - m_children.append(new DocSymbol(this,DocSymbol::At)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_At)); break; case CMD_LESS: - m_children.append(new DocSymbol(this,DocSymbol::Less)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Less)); break; case CMD_GREATER: - m_children.append(new DocSymbol(this,DocSymbol::Greater)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Greater)); break; case CMD_AMP: - m_children.append(new DocSymbol(this,DocSymbol::Amp)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Amp)); break; case CMD_DOLLAR: - m_children.append(new DocSymbol(this,DocSymbol::Dollar)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Dollar)); break; case CMD_HASH: - m_children.append(new DocSymbol(this,DocSymbol::Hash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Hash)); break; case CMD_PIPE: - m_children.append(new DocSymbol(this,DocSymbol::Pipe)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Pipe)); break; case CMD_DCOLON: - m_children.append(new DocSymbol(this,DocSymbol::DoubleColon)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_DoubleColon)); break; case CMD_PERCENT: - m_children.append(new DocSymbol(this,DocSymbol::Percent)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Percent)); break; case CMD_QUOTE: - m_children.append(new DocSymbol(this,DocSymbol::Quot)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot)); break; case CMD_SA: g_inSeeBlock=TRUE; @@ -6691,11 +6561,10 @@ reparsetoken: break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); - if (s!=DocSymbol::Unknown) + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); + if (s!=DocSymbol::Sym_Unknown) { - m_children.append(new DocSymbol(this,s,letter)); + m_children.append(new DocSymbol(this,s)); } else { @@ -6910,11 +6779,10 @@ void DocText::parse() break; case TK_SYMBOL: { - char letter='\0'; - DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); - if (s!=DocSymbol::Unknown) + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); + if (s!=DocSymbol::Sym_Unknown) { - m_children.append(new DocSymbol(this,s,letter)); + m_children.append(new DocSymbol(this,s)); } else { @@ -6927,34 +6795,34 @@ void DocText::parse() switch (Mappers::cmdMapper->map(g_token->name)) { case CMD_BSLASH: - m_children.append(new DocSymbol(this,DocSymbol::BSlash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_BSlash)); break; case CMD_AT: - m_children.append(new DocSymbol(this,DocSymbol::At)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_At)); break; case CMD_LESS: - m_children.append(new DocSymbol(this,DocSymbol::Less)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Less)); break; case CMD_GREATER: - m_children.append(new DocSymbol(this,DocSymbol::Greater)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Greater)); break; case CMD_AMP: - m_children.append(new DocSymbol(this,DocSymbol::Amp)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Amp)); break; case CMD_DOLLAR: - m_children.append(new DocSymbol(this,DocSymbol::Dollar)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Dollar)); break; case CMD_HASH: - m_children.append(new DocSymbol(this,DocSymbol::Hash)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Hash)); break; case CMD_DCOLON: - m_children.append(new DocSymbol(this,DocSymbol::DoubleColon)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_DoubleColon)); break; case CMD_PERCENT: - m_children.append(new DocSymbol(this,DocSymbol::Percent)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Percent)); break; case CMD_QUOTE: - m_children.append(new DocSymbol(this,DocSymbol::Quot)); + m_children.append(new DocSymbol(this,DocSymbol::Sym_Quot)); break; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected command `%s' found", |