|
From: | 魏 蜀曦 |
Subject: | request for member in something not a structure or union |
Date: | Mon, 14 Apr 2003 20:33:28 +0800 |
I have the error: request for member `str' in something not a structure or union
when i compile my parser.
%union {
int iValue; /* integer value */
char *str; /* a character string */
char *ipValue; /* node pointer */
TreeNode *nPtr;
};
%token <iValue>INTEGER
%token <str>VARIABLE STRING
%token <ipValue>IP_ADDR
%token IF PRINT RULE_LEAF RULE_TREE
%token FALSE TRUE
%token PROTO IP ICMP TCP UDP
%token SRC_ADDR DST_ADDR SRC_PORT DST_PORT
%token TTL ID CONTENT OFFSET DEPTH NOCASE FLAGS DSIZE
%token SEQ ITYPE ICODE ICMP_ID IP_OPTION
%token RR EOL NOP TS SEC LSRR SSRR SATID
%token FIN ACK SYN PSH URG RST
%nonassoc IFX
%nonassoc ELSE
%left OR
%left AND
%nonassoc NOT
%left GE LE EQ NE '>' '<'
%nonassoc UMINUS
%type <nPtr> stmt expr stmt_list term rterm identifier
%type <nPtr> rule body function assign var_assign
%type <nPtr> keyword_offset keyword_depth keyword_nocase keyword_int
%type <nPtr> keyword_ip keyword_proto keyword_ipoption ip_option keyword_flags
%type <nPtr> flag keyword_content boolv integer string proto ip_addr
...
...
rule:
RULE_TREE string '{' body '}' {tree=NewTreeNode(RULE,2,$2,$4);}
;
body: assign function {$$=NewTreeNode(BODY,2,$1,$2);}
;
function:
function stmt {$$=NewTreeNode(FUNCTION,2,$1,$2);}
...
typedef struct
{
NodeType type;
Value value;
SymDesc *symbol;
KeyWord KeywordIndex;
int nops;
DataType rettype;
TreeNode *child[1];
}TreeNode;
errors:
calc3.y:198: request for member `nPtr' in something not a structure or union
calc3.y:198: request for member `nPtr' in something not a structure or union
calc3.y:199: request for member `nPtr' in something not a structure or union
calc3.y:199: request for member `nPtr' in something not a structure or union
calc3.y:200: request for member `nPtr' in something not a structure or union
calc3.y:200: request for member `nPtr' in something not a structure or union
calc3.y:201: request for member `nPtr' in something not a structure or union
calc3.y:201: request for member `nPtr' in something not a structure or union
calc3.y:202: request for member `nPtr' in something not a structure or union
calc3.y:202: request for member `nPtr' in something not a structure or union
calc3.y:203: request for member `nPtr' in something not a structure or union
calc3.y:203: request for member `nPtr' in something not a structure or union
calc3.y:204: request for member `nPtr' in something not a structure or union
calc3.y:204: request for member `nPtr' in something not a structure or union
calc3.y:207: request for member `nPtr' in something not a structure or union
calc3.y:208: request for member `nPtr' in something not a structure or union
calc3.y:208: request for member `str' in something not a structure or union
...
How can this problem be resolved?
[Prev in Thread] | Current Thread | [Next in Thread] |