Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Code completion doesnt follow #include in struct
zacaj:
Because that looks really weird. I use it in less used classes, but for something as common as Object, I dont want to have to type an extra ->base-> every time I change the position
ollydbg:
--- Quote from: zacaj on March 04, 2011, 09:55:39 pm ---Because that looks really weird. I use it in less used classes, but for something as common as Object, I dont want to have to type an extra ->base-> every time I change the position
--- End quote ---
I think we can not solve your problem unless we use a full preprocessor/parser framework. :D
JGM:
some weeks ago I started working on a simple to use cpp parser mainly a prepreocessor just for fun. I worked on it about 2 days and was fixing some special cases where the parser wouldn't parse some things as it should do, so some code is commented out since I was debugging it, I was developing it on ubuntu and only using c/c++ standard libraries. I was programming it on a way that the preprocessor would return the final code as it should look for normal parsing and each elements on the code tokenized and identified by enums. Also I did some function place holders for expressions parsing and other things left to do. So if someone is interested on checking it out I uploaded the code to mediafire on a zip file:
http://www.mediafire.com/?yqvsstq23jot650
Comments and suggestions are welcome, I stopped after reading about clang with all it's advanced features, but if someone thinks this could be useful a spark of motivation may come to light xD (i gave up but then thought that the code may be of some use, and I think I was implementing it on a way not so hard to maintain for the future, but after all I'm a noob xD)
Edit: whoa I reached post 500 :D
ollydbg:
nice work, I am downloading your code and do some checking.
I know clang was a full preprocessor/parser framework. but it was too complex, and it was released under BSD style license. And finally I switch my mind to gcc. I have read the gcc's cpp internal manual (development manual), and found that developing a preprocessor was really complex.
the advantage of a full preprocessor/parser framework is that it has one AST tree for every translation unit, so, it is precise, but slow.
and currently cc's implementation is: parse every file only once, and collect every token to a single tree, just like ctags did, even there are some files missing, cc's parser still do some guess and continue parsing.
for a preprocessor framework, I remembered that One c::b developer has implemented a preprocessor(but it was hard to read for me)
ollydbg:
--- Quote from: JGM on March 23, 2011, 07:57:00 am ---Comments and suggestions are welcome, I stopped after reading about clang with all it's advanced features, but if someone thinks this could be useful a spark of motivation may come to light xD (i gave up but then thought that the code may be of some use, and I think I was implementing it on a way not so hard to maintain for the future, but after all I'm a noob xD)
--- End quote ---
here are my two point
1, I think using a generated lexer will make things much easier. a generated lexer can handle somethings like: line counting, column counting, and it use a state machine which will catch the "keyword" much faster than "clang or gcc". (both clang and gcc does not distinguish between a keyword or an identifier, they just do a hashtable search when an identifier returned), from this point, I'd suggest my work on Quex based lexer. ( I do benchmarks showing that it was 200% as the speed of flex generated lexer under windows). I put the test code here( also it include a clang test project to test codecompletion feature of clang )
http://code.google.com/p/quexparser/
would you like to have a look?
2, I found you use std::vector in the code, does std::list is much better? when doing a macro replacement, a vector will always re-size itself.
Currently, I feel a little confused about my quexparser, I do not have a clean direction, I found that even doing a macro replacement need many tricky.
you can look at
http://gcc.gnu.org/onlinedocs/cppinternals/
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version