Re: The Array type
Luke Petre <[email protected]>
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
It seems like it would be best to do in the Decoder, but I don't think
you have enough information at that point. Thoughts?
Luke Petre wrote:
> Bah - turns out that is not the "Right Way", since it doesn't work
> half the time. Any thoughts on the correct way to get the Array
> dimensions?
>
> Luke Petre wrote:
>
>> I have to admit that my interest in Synopsis is primarily because it
>> parses C++ very nicely.
>>
>> That being said I've noticed that the Array type doesn't seem to be
>> parsed correctly, at least not for member variables. I've added the
>> following code to swalker.cc, although I'm not 100% sure this is The
>> Right Way to approach the problem.
>>
>> This is in swalker.cc, the function
>> SWalker::TranslateVariableDeclarator. At about line 1137.
>>
>> ...
>> // sizes support
>> if ( *enctype == 'A' )
>> {
>> bool array = false;
>> Types::Array::Mods sizes;
>> Ptree* pStart = decl->Cdr()->Cdr();
>> char* type2 = enctype;
>> while ( *type2 == 'A' )
>> {
>> Ptree* pDim = pStart->Cdr();
>> sizes.push_back( pDim->First()->string() );
>> pStart = pDim->Cdr()->Cdr();
>> ++type2;
>> array = true;
>> }
>>
>> if ( array )
>> {
>> type = new Types::Array( type, sizes );
>> }
>> }
>> ...
>>
>> I'm also very curious where the //.< syntax is handled. I've looked
>> everywhere and can't really get my head around the previous comment
>> feature.
>>
>> Keep up the excellent work!
>>
>> Luke
>>
>>
>