1 ##############################################################################
3 # $$: return value. the label used in other place, should return a value for
5 # $N: the N'th paramter. if it is not a token generated from lexer, it must be
6 # a grammar-define in other place, and it should return a value.
7 # xxx_list: list extension. it include some grammar-define in a totoal grammer-
8 # define list. eg: multi-statement in a block.
9 # xxx_tree: tree structure defination. eg: calc/judgement expr.
10 # xxx_stmt: statement. maybe with xxx_blk.
11 # xxx_blk: block, it include a xxx_list in it. or all content in it is a txt
12 # block. totaol file is a big block. block can be associated with a
14 ##############################################################################
16 lxr_section: [ T_WORD ] nl { $$=$2; add_section($2); }
19 lxr_charset nl { $$=$1; }
20 | lxr_token nl { $$=$1; }
21 | lxr_state nl { $$=$1; }
22 | lxr_def_list nl { $$=$1; }
24 lxr_charset: T_WORD T_WORD nl { $$=add_charset(state, $1, $2);}
27 RESP ( T_WORD ) nl { $$=new_resp(); $$.proc=$3; }
28 | RESP ( T_WORD ) nl { $$=new_resp(); $$.id = $3; }
29 | T_BLOCKTEXT nl { $$=new_resp(); $$.script = $1; }
34 | nl T_AND nl { $$=$3; }
36 | nl T_OR nl { $$=$2; }
43 | nl T_XOR nl { $$=$2; }
46 * new expr, append current to it.
47 * new expr node alloced, append to $1,
48 * return new expr node as curr.
49 * root node is paramter $1 of lxr_token.
53 | nl T_NOT T_WORD { $$=new_str_expr(NULL, $2, $3); }
54 | T_NOT nl T_WORD { $$=new_str_expr(NULL, $1, $3); }
55 | nl T_NOT nl T_WORD { $$=new_str_expr(NULL, $2, $4); }
56 | lxr_str_expr lxr_opr T_WORD { $$=new_str_expr($1, $2, $3); }
58 lxr_token: lxr_str_expr lxr_response {
59 type=get_token_type($1);
61 token = add_rsv_word(state, $1, $2);
63 token = add_lxr_def(state, $1, $2);
65 //add_token_def(token, $1, $2);
68 lxr_state_name: < T_WORD > {
70 /* create new state "$2", append it to state */
71 state=add_new_state(state, $2);
75 lxr_state_name { lxr_def_list } nl { state=pop_state(); }
76 | lxr_state_name { nl lxr_def_list } nl { state=pop_state(); }
77 | lxr_state_name nl { lxr_def_list } nl { state=pop_state(); }
78 | lxr_state_name nl { nl lxr_def_list } nl { state=pop_state(); }