Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
code completion plugin parser test project with cmd
visualfc:
Helo, I make cctest , a eary test CodeBlocks codecompletion function to parser cpp file program.
The cctest modify CodeCompletion Token and ParserThread lib, only use STL, a std::string and std::wstring (#define CC_UNICODE) , I'm test by WX and QT. cctest project is make by CodeBlocks, build and run on WindowXP and Ubuntu 64bit.
new download source cctest_v3.zip
cctest run on WindowXP 32bit
--- Code: ---Hello world! C++ Parser Programing!
-> cmd: (load,files,clear) (list,tree,show,dump) (log,logoff) (help,exit) log=off
load filename load c++ file path
files show load files
clear clear all files
list show token by list
tree show token by tree
show n show signal file token by tree
dump dump token tree
log filename setup log filepath
logoff setup log = std::cout
help show this help
exit exit application
-> log d:\log.txt
log=d:\log.txt
-> load d:\project\cctest\main.cpp
load file ok! d:\project\cctest\main.cpp
-> tree
+class FileLoader {...} [24,0]
| data() [28,28]
| length() [32,32]
| fileName() [36,36]
| FileLoader::FileLoader(const char* fileName) [40,40]
| isLoad() [45,45]
| load() [50,50]
| char * FileLoader::name [61,0]
| char * FileLoader::buf [62,0]
| int FileLoader::buf_size [63,0]
+class ParserClient {...} [66,0]
| ParserClient::ParserClient() [70,70]
| ParserClient::~ParserClient() [74,74]
| parser(const char * fileName) [78,78]
| clear() [100,100]
| GetFullFileName(const cc_string & Filename,const cc_string& filename,bool isGlobal) [106,106]
| OnParseFile(const cc_string & filename, int flag) [110,110]
| printToken(std::ostream & f, Token* tk, const string & head) [114,114]
| printTokenTree(std::ostream & f, Token* tk, const string & head) [127,127]
| printList(std::ostream & f) [138,138]
| printTree(std::ostream & f) [148,148]
| printFiles(std::ostream & f) [161,161]
| printFileToken(std::ostream & f, int n) [168,168]
| TokensTree * ParserClient::tree [184,0]
| vector ParserClient::files [185,0]
showHelp(std::string & logname) [189,189]
main() [206,206]
-> dump
- "" (0)
+- "FileLoader" (1)
+- "GetFullFileName" (14)
+- "OnParseFile" (15)
+- "ParserClient" (10)
+- "buf_size" (9)
+- "clear" (13)
+- "data" (2)
+- "file" (26)
| +- "Name" (4)
| \- "s" (27)
+- "isLoad" (5)
+- "l" (6)
| +- "ength" (3)
| \- "oad" (7)
+- "main" (29)
+- "name" (8)
+- "p" (16)
| +- "arser" (12)
| \- "rint" (18)
| +- "File" (23)
| | +- "Token" (24)
| | \- "s" (22)
| +- "List" (19)
| \- "T" (20)
| +- "okenTree" (17)
| \- "ree" (21)
+- "showHelp" (28)
+- "tree" (25)
\- "~ParserClient" (11)
->exit
--- End code ---
cctest run on Ubuntu9.10 64-bit cclog file text
--- Code: ---log time: Mon Dec 7 14:58:25 2009
command:load
load file:/home/win32/share/cctest/main.cpp
command:files
0. /home/win32/share/cctest/main.cpp
command:show
show file:/home/win32/share/cctest/main.cpp
+class FileLoader {...} [24,0]
| data() [27,27]
| length() [31,31]
| fileName() [35,35]
| FileLoader::FileLoader(const char* fileName) [40,40]
| isLoad() [44,44]
| load() [49,49]
| char * FileLoader::name [61,0]
| char * FileLoader::buf [62,0]
| int FileLoader::buf_size [63,0]
+class ParserClient {...} [66,0]
| ParserClient::ParserClient() [69,69]
| ParserClient::~ParserClient() [73,73]
| parser(const char * fileName) [77,77]
| clear() [99,99]
| GetFullFileName(const cc_string & Filename,const cc_string& filename,bool isGlobal) [105,105]
| OnParseFile(const cc_string & filename, int flag) [109,109]
| printToken(std::ostream & f, Token* tk, const string & head) [113,113]
| printTokenTree(std::ostream & f, Token* tk, const string & head) [126,126]
| printList(std::ostream & f) [137,137]
| printTree(std::ostream & f) [148,148]
| printFiles(std::ostream & f) [161,161]
| printFileToken(std::ostream & f, int n) [168,168]
| TokensTree * ParserClient::tree [185,0]
| vector ParserClient::files [186,0]
showHelp(std::string & logname) [189,189]
main() [206,206]
command:tree
+class FileLoader {...} [24,0]
| data() [27,27]
| length() [31,31]
| fileName() [35,35]
| FileLoader::FileLoader(const char* fileName) [40,40]
| isLoad() [44,44]
| load() [49,49]
| char * FileLoader::name [61,0]
| char * FileLoader::buf [62,0]
| int FileLoader::buf_size [63,0]
+class ParserClient {...} [66,0]
| ParserClient::ParserClient() [69,69]
| ParserClient::~ParserClient() [73,73]
| parser(const char * fileName) [77,77]
| clear() [99,99]
| GetFullFileName(const cc_string & Filename,const cc_string& filename,bool isGlobal) [105,105]
| OnParseFile(const cc_string & filename, int flag) [109,109]
| printToken(std::ostream & f, Token* tk, const string & head) [113,113]
| printTokenTree(std::ostream & f, Token* tk, const string & head) [126,126]
| printList(std::ostream & f) [137,137]
| printTree(std::ostream & f) [148,148]
| printFiles(std::ostream & f) [161,161]
| printFileToken(std::ostream & f, int n) [168,168]
| TokensTree * ParserClient::tree [185,0]
| vector ParserClient::files [186,0]
showHelp(std::string & logname) [189,189]
main() [206,206]
command:list
class class FileLoader {...} [24,0]
function char * FileLoader::data() [27,27]
function unsigned int FileLoader::length() [31,31]
function char * FileLoader::fileName() [35,35]
constructor FileLoader::FileLoader(const char* fileName) [40,40]
function bool FileLoader::isLoad() [44,44]
function void FileLoader::load() [49,49]
variable char * FileLoader::name [61,0]
variable char * FileLoader::buf [62,0]
variable int FileLoader::buf_size [63,0]
class class ParserClient {...} [66,0]
constructor ParserClient::ParserClient() [69,69]
destructor ParserClient::~ParserClient() [73,73]
function bool ParserClient::parser(const char * fileName) [77,77]
function void ParserClient::clear() [99,99]
function cc_string ParserClient::GetFullFileName(const cc_string & Filename,const cc_string& filename,bool isGlobal) [105,105]
function void ParserClient::OnParseFile(const cc_string & filename, int flag) [109,109]
function void ParserClient::printToken(std::ostream & f, Token* tk, const string & head) [113,113]
function void ParserClient::printTokenTree(std::ostream & f, Token* tk, const string & head) [126,126]
function void ParserClient::printList(std::ostream & f) [137,137]
function void ParserClient::printTree(std::ostream & f) [148,148]
function void ParserClient::printFiles(std::ostream & f) [161,161]
function void ParserClient::printFileToken(std::ostream & f, int n) [168,168]
variable TokensTree * ParserClient::tree [185,0]
variable vector ParserClient::files [186,0]
function void showHelp(std::string & logname) [189,189]
function int main() [206,206]
command:dump
- "" (0)
+- "FileLoader" (1)
+- "GetFullFileName" (14)
+- "OnParseFile" (15)
+- "ParserClient" (10)
+- "buf_size" (9)
+- "clear" (13)
+- "data" (2)
+- "file" (26)
| +- "Name" (4)
| \- "s" (27)
+- "isLoad" (5)
+- "l" (6)
| +- "ength" (3)
| \- "oad" (7)
+- "main" (29)
+- "name" (8)
+- "p" (16)
| +- "arser" (12)
| \- "rint" (18)
| +- "File" (23)
| | +- "Token" (24)
| | \- "s" (22)
| +- "List" (19)
| \- "T" (20)
| +- "okenTree" (17)
| \- "ree" (21)
+- "showHelp" (28)
+- "tree" (25)
\- "~ParserClient" (11)
command:clear
clear all files
command:help
command:exit
--- End code ---
[attachment deleted by admin]
blueshake:
Note:
VisualFC had separated the parser from the codecompletion.and he made some change.
1.he changed the wxSting to string,so the parser use purely stl lib now.
2. you can switch between wstring and string by define CC_UNICODE under wx or QT project.
3.in this cmd-project ,only string is supported.
4.you can use cb to build this project.After built and run,the program will ask you to input the file which you want to parse.and then you can use command "tree" to see the output.
welcome to test and thanks visualfc
oBFusCATed:
Great, if this thing works (can't test it at the moment), we are one step closer to automated testing of the codecompletion code :)
Keep going:)
ollydbg:
I just tested this program. It works OK!
The only drawback is that Console window has limited width, so, there are some sentences wrapping in the output. :(
Edit:
How about using the Rickg22's Token Trie output function. see rickg22's SearchTree development
blueshake:
--- Quote from: ollydbg on December 05, 2009, 07:04:49 am ---I just tested this program. It works OK!
The only drawback is that Console window has limited width, so, there are some sentences wrapping in the output. :(
Edit:
How about using the Rickg22's Token Trie output function. see rickg22's SearchTree development
--- End quote ---
I have suggest visualfc to output the result to file.but he is busy with his qt plugin.so ...
Navigation
[0] Message Index
[#] Next page
Go to full version