On 01/17/2012 11:33 PM, 刘智猷 wrote:
> Hi all,
> Recently I am trying functions memtioned in semantic-appdev.info
> <http://semantic-appdev.info>. But I found variables such as 'row' and 'col'
> for (int row = 0; row < N; ++row)
> for (int col = 0; col < N; ++col) {
> A[row][col] = lrand48();
> }
> will not be return by (semantic-get-all-local-variables) or
> (semantic-analyze-current-context) when my cursor on A[row][col].
> I am wondering it's a bug or I made some mistakes about context?
>
> Regards,
> easyhard
Hi,
The general context parser for semantic finds the beginning of the
current context, and then parses for variables. for example, if ! is
the cursor:
{ int i;
{ int j;
!
}
}
it will find j, and i. With your for loops, the new decl is hidden
inside the for loop arguments. I would classify this as a limitation of
the context parser in Semantic.
If someone wanted to, special case for for loops could be made, but I
imagine that would be a bit tricky to make work reliably.
Eric
|