1%{
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
--- 5 unchanged lines hidden (view full) ---
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 */
23#ifndef lint
24static const char rcsid[] =
25 "@(#) $Header: grammar.y,v 1.56 96/11/02 21:54:55 leres Exp $ (LBL)";
26#endif
27
28#include <sys/types.h>
29#include <sys/time.h>
30#include <sys/socket.h>
31
32#if __STDC__
33struct mbuf;
--- 63 unchanged lines hidden (view full) ---
97%type <blk> head
98%type <i> pqual dqual aqual ndaqual
99%type <a> arth narth
100%type <i> byteop pname pnum relop irelop
101%type <blk> and or paren not null prog
102%type <rblk> other
103
104%token DST SRC HOST GATEWAY
105%token NET MASK PORT LESS GREATER PROTO BYTE
106%token ARP RARP IP TCP UDP ICMP IGMP IGRP
107%token ATALK DECNET LAT SCA MOPRC MOPDL
108%token TK_BROADCAST TK_MULTICAST
109%token NUM INBOUND OUTBOUND
110%token LINK
111%token GEQ LEQ NEQ
112%token ID EID HID
113%token LSH RSH
114%token LEN
115%token ISO ESIS ISIS
116
117%type <s> ID
118%type <e> EID
119%type HID
120%type <i> NUM
121
122%left OR AND
123%nonassoc '!'
124%left '|'
125%left '&'
126%left LSH RSH
127%left '+' '-'
--- 35 unchanged lines hidden (view full) ---
163 case Q_DECNET:
164 $$.b = gen_ncode($1, 0, $$.q);
165 break;
166 default:
167 $$.b = gen_ncode($1, 0, $$.q);
168 break;
169 }
170 }
171 | EID { $$.b = gen_ecode($1, $$.q = $<blk>0.q); }
172 | not id { gen_not($2.b); $$ = $2; }
173 ;
174not: '!' { $$ = $<blk>0; }
175 ;
176paren: '(' { $$ = $<blk>0; }
177 ;
178pid: nid
--- 6 unchanged lines hidden (view full) ---
185 ;
186term: rterm
187 | not term { gen_not($2.b); $$ = $2; }
188 ;
189head: pqual dqual aqual { QSET($$.q, $1, $2, $3); }
190 | pqual dqual { QSET($$.q, $1, $2, Q_DEFAULT); }
191 | pqual aqual { QSET($$.q, $1, Q_DEFAULT, $2); }
192 | pqual PROTO { QSET($$.q, $1, Q_DEFAULT, Q_PROTO); }
193 | pqual ndaqual { QSET($$.q, $1, Q_DEFAULT, $2); }
194 ;
195rterm: head id { $$ = $2; }
196 | paren expr ')' { $$.b = $2.b; $$.q = $1.q; }
197 | pname { $$.b = gen_proto_abbrev($1); $$.q = qerr; }
198 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0);
199 $$.q = qerr; }
200 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1);
--- 24 unchanged lines hidden (view full) ---
225 | IP { $$ = Q_IP; }
226 | ARP { $$ = Q_ARP; }
227 | RARP { $$ = Q_RARP; }
228 | TCP { $$ = Q_TCP; }
229 | UDP { $$ = Q_UDP; }
230 | ICMP { $$ = Q_ICMP; }
231 | IGMP { $$ = Q_IGMP; }
232 | IGRP { $$ = Q_IGRP; }
233 | ATALK { $$ = Q_ATALK; }
234 | DECNET { $$ = Q_DECNET; }
235 | LAT { $$ = Q_LAT; }
236 | SCA { $$ = Q_SCA; }
237 | MOPDL { $$ = Q_MOPDL; }
238 | MOPRC { $$ = Q_MOPRC; }
239 | ISO { $$ = Q_ISO; }
240 | ESIS { $$ = Q_ESIS; }
241 | ISIS { $$ = Q_ISIS; }
242 ;
243other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
244 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
245 | LESS NUM { $$ = gen_less($2); }
246 | GREATER NUM { $$ = gen_greater($2); }
--- 39 unchanged lines hidden ---
2/*
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
--- 5 unchanged lines hidden (view full) ---
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
17 * written permission.
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 */
23#ifndef lint
24static const char rcsid[] =
25 "@(#) $Header: grammar.y,v 1.56 96/11/02 21:54:55 leres Exp $ (LBL)";
26#endif
27
28#include <sys/types.h>
29#include <sys/time.h>
30#include <sys/socket.h>
31
32#if __STDC__
33struct mbuf;
--- 63 unchanged lines hidden (view full) ---
97%type <blk> head
98%type <i> pqual dqual aqual ndaqual
99%type <a> arth narth
100%type <i> byteop pname pnum relop irelop
101%type <blk> and or paren not null prog
102%type <rblk> other
103
104%token DST SRC HOST GATEWAY
105%token NET MASK PORT LESS GREATER PROTO BYTE
106%token ARP RARP IP TCP UDP ICMP IGMP IGRP
107%token ATALK DECNET LAT SCA MOPRC MOPDL
108%token TK_BROADCAST TK_MULTICAST
109%token NUM INBOUND OUTBOUND
110%token LINK
111%token GEQ LEQ NEQ
112%token ID EID HID
113%token LSH RSH
114%token LEN
115%token ISO ESIS ISIS
116
117%type <s> ID
118%type <e> EID
119%type
120%type <i> NUM
121
122%left OR AND
123%nonassoc '!'
124%left '|'
125%left '&'
126%left LSH RSH
127%left '+' '-'
--- 35 unchanged lines hidden (view full) ---
163 case Q_DECNET:
164 $$.b = gen_ncode($1, 0, $$.q);
165 break;
166 default:
167 $$.b = gen_ncode($1, 0, $$.q);
168 break;
169 }
170 }
171 | EID { $$.b = gen_ecode($1, $$.q = $<blk>0.q); }
172 | not id { gen_not($2.b); $$ = $2; }
173 ;
174not: '!' { $$ = $<blk>0; }
175 ;
176paren: '(' { $$ = $<blk>0; }
177 ;
178pid: nid
--- 6 unchanged lines hidden (view full) ---
185 ;
186term: rterm
187 | not term { gen_not($2.b); $$ = $2; }
188 ;
189head: pqual dqual aqual { QSET($$.q, $1, $2, $3); }
190 | pqual dqual { QSET($$.q, $1, $2, Q_DEFAULT); }
191 | pqual aqual { QSET($$.q, $1, Q_DEFAULT, $2); }
192 | pqual PROTO { QSET($$.q, $1, Q_DEFAULT, Q_PROTO); }
193 | pqual ndaqual { QSET($$.q, $1, Q_DEFAULT, $2); }
194 ;
195rterm: head id { $$ = $2; }
196 | paren expr ')' { $$.b = $2.b; $$.q = $1.q; }
197 | pname { $$.b = gen_proto_abbrev($1); $$.q = qerr; }
198 | arth relop arth { $$.b = gen_relation($2, $1, $3, 0);
199 $$.q = qerr; }
200 | arth irelop arth { $$.b = gen_relation($2, $1, $3, 1);
--- 24 unchanged lines hidden (view full) ---
225 | IP { $$ = Q_IP; }
226 | ARP { $$ = Q_ARP; }
227 | RARP { $$ = Q_RARP; }
228 | TCP { $$ = Q_TCP; }
229 | UDP { $$ = Q_UDP; }
230 | ICMP { $$ = Q_ICMP; }
231 | IGMP { $$ = Q_IGMP; }
232 | IGRP { $$ = Q_IGRP; }
233 | ATALK { $$ = Q_ATALK; }
234 | DECNET { $$ = Q_DECNET; }
235 | LAT { $$ = Q_LAT; }
236 | SCA { $$ = Q_SCA; }
237 | MOPDL { $$ = Q_MOPDL; }
238 | MOPRC { $$ = Q_MOPRC; }
239 | ISO { $$ = Q_ISO; }
240 | ESIS { $$ = Q_ESIS; }
241 | ISIS { $$ = Q_ISIS; }
242 ;
243other: pqual TK_BROADCAST { $$ = gen_broadcast($1); }
244 | pqual TK_MULTICAST { $$ = gen_multicast($1); }
245 | LESS NUM { $$ = gen_less($2); }
246 | GREATER NUM { $$ = gen_greater($2); }
--- 39 unchanged lines hidden ---