[antlr-interest] Need help vector in C generated code

Jim Idle jimi at temporal-wave.com
Mon Jan 10 19:32:22 PST 2011


Try restating your question as it makes no sense at all as asked. Read through the runtime source for examples but usually a question like this means you are approaching it incorrectly to be honest. 

Go ducks. 

Jim

On Jan 10, 2011, at 19:14, Jeffrey Newman <jeffn at photorepo.com> wrote:

> I'm trying to implement a SQL parser. 
> I'm working from the SQLite grammar.
> 
> I need to return a column type. (e.g. var char)
> 
> The problem is that there is no vectors in the ctx structure.
> 
> I have not been able to find and example of using the vectors.
> 
> If I use name = ID+
> then the name is just stomped with char, the var is gone.
> 
> Please help.
> Please direct me where I see and example of using the C vectors.
> How to include them, how to access them, how to make the generated code complie.
> 
> thanks
> 
> thanks
> 
> Jeffrey
> \
> 
> 
> type_name returns [ColumnTypeData ctd]
> @init {
>    int cnt;
>    cnt = 0;
>    
>    ctd.name  = NULL;
>    ctd.scale     = 0;
>    ctd.precision = 0;
> }
>    : name+=ID+ (LPAREN size1=signed_number (COMMA size2=signed_number)? RPAREN)?
>      {
> 
>      }
>    ;
> 
> 
> Generates (edited)
> 
>                        {
>                            name = (pANTLR3_COMMON_TOKEN) MATCHT(ID, &FOLLOW_ID_in_type_name1283); 
>                            if  (HASEXCEPTION())
>                            {
>                                goto ruletype_nameEx;
>                            }
> 
>                            if (list_name == NULL)
>                            {
>                                list_name=ctx->vectors->newVector(ctx->vectors);
>                            }
>                            list_name->add(list_name, name, NULL);
> 
>                        }
>                        break;
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list