Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
CodeCompletion plugin
ollydbg:
--- Quote from: MortenMacFly on April 21, 2011, 07:14:46 am ---What is an "auto variable"? :shock:
--- End quote ---
Oh, sorry, should be: local variable, or automatic variable
http://en.wikipedia.org/wiki/Automatic_variable
:D
Both the cases in killerbot's example is local variables.
killerbot:
it's like reading the function arguments, with the difference you can encounter also assignments and regular statements [eg ++foo]
ollydbg:
there are many possibilities usage like:
--- Code: ---//type + variable
for(int a=0;.....)
for(NS::MyClass a=0;...)
// type containing some template info
for(MyNameSpace::MyTempLateClass<X,Y> a=0;...)
// pointer declaration
for(int *a=0;...)
for(int **a=0;...)
// two variables
for(int *a=0, b=0;...)
--- End code ---
It is a bit complex. :D
BTW: The currently tokenizer even can't distinguish "+" and "++" (Morten's latest patch seems try to do a workaround in the parserthread). I think we need a "type id bundled return token" instead a pure wxString token.
killerbot:
yes, but I would suggest to support them one by one, increasing the complexity.
But all your examples are things that are also possible on a regular line. That's why I had the idea 'to mimic' as if those lines are inside the for loop, and have the parser parse them there (scope wise that's the correct behavior), line number wise one has to remember they are a few lines up.
By the way, don't forget this one ;-)
--- Code: ---for(int index = 0; Foo* foofoo = Something.getFooByIndex(index); ++index)
{
// let's do something with foofoo
}
--- End code ---
ollydbg:
I'm thinking and doing some experiments, I would like to reuse the code, so, look:
Here, DoParse() is our conventionalmethod to correct Symbols.
When we were handling "for" statement, when we meet a "(", we can recursively call another DoParse(), then if it meets an unbalanced ")", it just returned. Next, if it is a "{", we just do the same thing, but the DoParse() returned at an unbalanced "}".
It is the same thing as we parse the class declaration like
--- Code: ---class MyClass
{
int m_a;
int m_b;
}
--- End code ---
Here, DoParse() will be called when we try to read the class members.
It works quite well in my quex parser project, the code snippet looks like:
--- Code: ---void ParserThread::HandleForWhile()
{
ConsumeToken(); //eat for or while key word
ConsumeToken(); //eat the left parenthesis
PushContext(); //save the old context
m_Context.EndStatement();
DoParse(); // do a parse, and should returned on an unbalanced right parenthesis
PopContext(); // restore the old context
RawToken * tok = PeekToken();
if(tok->type_id()==TKN_L_BRACE)
{
ConsumeToken(); //eat {
PushContext(); //save the old context
m_Context.EndStatement();
DoParse(); // do a parse, and should returned on an unbalanced right brace
PopContext(); // restore the old context
}
else
SkipStatementBlock();
}
--- End code ---
As using quex lexer, parsing is much easier than the current implementation. :D
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version