[BUG_FIXED] Fix a crash issue while there's missing tag in function list.

[BUG_FIXED] Fix function list parses C++ class (*.h) problem while there is comment on the beginning of document.
[ENHANCEMENT] Enhance C/C++ parse result for function list.


git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1101 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-08-08 16:08:29 +00:00
parent f2fc738576
commit 59fc425d7d
3 changed files with 13 additions and 12 deletions

View File

@ -5186,7 +5186,7 @@ struct Quote{
const char *_quote; const char *_quote;
}; };
const int nbQuote = 138; const int nbQuote = 141;
Quote quotes[nbQuote] = { Quote quotes[nbQuote] = {
{"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."}, {"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."},
{"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."}, {"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."},
@ -5317,6 +5317,9 @@ Quote quotes[nbQuote] = {
{"Anonymous #97", "Real Programmers don't comment their code.\nIf it was hard to write, it should be hard to read."}, {"Anonymous #97", "Real Programmers don't comment their code.\nIf it was hard to write, it should be hard to read."},
{"Anonymous #98", "My neighbours listen to good music.\nWhether they like it or not."}, {"Anonymous #98", "My neighbours listen to good music.\nWhether they like it or not."},
{"Anonymous #99", "Mondays are not so bad.\nIt's your job that sucks."}, {"Anonymous #99", "Mondays are not so bad.\nIt's your job that sucks."},
{"Anonymous #100", "Dear YouTube,\nI can deal with Ads.\nI can deal with Buffer.\nBut when Ads buffer, I suffer."},
{"Anonymous #101", "It's always sad when a man and his dick share only one brain...\nand it turns out to be the dick's."},
{"Anonymous #102", "If IE is brave enough to ask you to set it as your default browser,\ndon't tell me you dare not ask a girl out."},
{"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."}, {"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."},
{"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."}, {"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."},
{"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company)\nto shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."}, {"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company)\nto shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."},

View File

@ -135,7 +135,7 @@ bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, g
} }
TiXmlNode *classNameParser = functionParser->FirstChild(TEXT("className")); TiXmlNode *classNameParser = functionParser->FirstChild(TEXT("className"));
if (functionNameParser) if (classNameParser)
{ {
for (TiXmlNode *childNode = classNameParser->FirstChildElement(TEXT("nameExpr")); for (TiXmlNode *childNode = classNameParser->FirstChildElement(TEXT("nameExpr"));
childNode; childNode;
@ -320,7 +320,7 @@ void FunctionParser::funcParse(std::vector<foundInfo> & foundInfos, size_t begin
if (classStructName != TEXT("")) if (classStructName != TEXT(""))
{ {
fi._data2 = classStructName; fi._data2 = classStructName;
fi._pos2 = 0; // change -1 valeur for validated data2 fi._pos2 = -1; // change -1 valeur for validated data2
} }
else if (_classNameExprArray.size()) else if (_classNameExprArray.size())
{ {

View File

@ -14,7 +14,7 @@
L_CMAKE: 48 L_YAML: 49 L_COBOL 50 L_GUI4CLI: 51 L_D: 52 L_POWERSHELL: 53 L_CMAKE: 48 L_YAML: 49 L_COBOL 50 L_GUI4CLI: 51 L_D: 52 L_POWERSHELL: 53
L_R: 54 L_JSP: 55 L_R: 54 L_JSP: 55
--> -->
<association langID = "2" id="cpp_class"/> <association langID = "2" id="c_function"/>
<association langID = "3" id="c_cpp_function"/> <association langID = "3" id="c_cpp_function"/>
<association langID = "19" id="js_function"/> <association langID = "19" id="js_function"/>
<!-- <!--
@ -25,7 +25,8 @@
</associationMap> </associationMap>
<parsers> <parsers>
<parser id="cpp_class" displayName="C++ Class" commentExpr="((/\*.*?\*)/|(//.*?$))"> <!-- Java parser : in progress, not working yet -->
<parser id="java" displayName="Java" commentExpr="((/\*.*?\*)/|(//.*?$))">
<classRange <classRange
mainExpr="^[\t ]*(class|struct)[\t ]+[\w]+[\s]*(:[\s]*(public|protected|private)[\s]+[\w]+[\s]*)?\{" mainExpr="^[\t ]*(class|struct)[\t ]+[\w]+[\s]*(:[\s]*(public|protected|private)[\s]+[\w]+[\s]*)?\{"
openSymbole = "\{" openSymbole = "\{"
@ -47,15 +48,12 @@
</parser> </parser>
<parser id="c_function" displayName="C source" commentExpr="((/\*.*?\*)/|(//.*?$))"> <parser id="c_function" displayName="C source" commentExpr="((/\*.*?\*)/|(//.*?$))">
<function <function
mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w]+([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_~]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{" mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w:]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"
displayMode="$className->$functionName"> displayMode="$functionName">
<functionName> <functionName>
<nameExpr expr="(?!(if|while|for))[\w_~]+[\s]*\("/> <nameExpr expr="(?!(if|while|for))[\w_~]+[\s]*\("/>
<nameExpr expr="(?!(if|while|for))[\w_~]+"/> <nameExpr expr="(?!(if|while|for))[\w_~]+"/>
</functionName> </functionName>
<className>
<nameExpr expr="[\w_]+(?=[\s]*::)"/>
</className>
</function> </function>
</parser> </parser>
@ -88,7 +86,7 @@
<nameExpr expr="[\w]+"/> <nameExpr expr="[\w]+"/>
</className> </className>
<function <function
mainExpr="^[\t ]*((static|const|virtual)[\s]+)?([\w]+([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"> mainExpr="^[\t ]*((static|const|virtual)[\s]+)?([\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+))?([\w_]+[\s]*::)?(?!(if|while|for|switch))[\w_~]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{">
<functionName> <functionName>
<funcNameExpr expr="(?!(if|while|for|switch))[\w_~]+[\s]*\("/> <funcNameExpr expr="(?!(if|while|for|switch))[\w_~]+[\s]*\("/>
<funcNameExpr expr="(?!(if|while|for|switch))[\w_~]+"/> <funcNameExpr expr="(?!(if|while|for|switch))[\w_~]+"/>
@ -96,7 +94,7 @@
</function> </function>
</classRange> </classRange>
<function <function
mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w]+([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{" mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"
displayMode="$className->$functionName"> displayMode="$className->$functionName">
<functionName> <functionName>
<nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/> <nameExpr expr="(?!(if|while|for))[\w_]+[\s]*\("/>