[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: request for member in something not a structure or union (yaccparse
From: |
Krishna Murthy Gudipati |
Subject: |
RE: request for member in something not a structure or union (yaccparse error) |
Date: |
Thu, 17 Jul 2003 17:45:44 +0530 (IST) |
Hello Tim,
I thank you very much for the info. I have defined it as struct port*
myPort; and worked as you suggested. But still how come gcc recognizes
struct port* myPort; and not Port* port;. Is it like when struct port*
port; is used the gcc will not bother whether struct port {} is already
included or defined earlier but it is conscious when Port* port; is used.
The same problem i have encountered while using enum like :
/* in the header file */
enum {IN, OUT, INOUT} MODE;
/* in the yacc parser file */
%union {
MODE mode; // gave error
enum MODE anotherMode; // gave error
}
Once again thank you very much.
Have good day.
Regards,
Krishna
Tim Van Holder
>> I have defined a structure in an header file as :
>>
>> typedef struct port{
>>
>> char* portName;
>> MODE portMode;
>> TYPE portType;
>> struct port* next;
>>
>> } PORT;
>>
>> And this header file is included in the yacc parser. I am
>> trying to define
>> the %union as follows :
>>
>> %union {
>> char* keyValue;
>> PORT* portStmnt;
>> }
>
> Bison generates a header with tokens as well as this type.
> No other headers are included in this file, and this can be
> annoying, especially since the generated parser source
> includes it before any other headers.
> Your only option is to use
>
> %union {
> char* keyValue;
> struct PORT* portStmnt;
> }
>
> instead.