- 论坛徽章:
- 0
|
我在编译parser的时候,遇到了这个问题,始终不能解决
request for member `str' in something not a structure or union
请问这个错误是什么意思?谢谢
%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
... |
|