scanner.l (26178) | scanner.l (39294) |
---|---|
1%{ 2/* | 1%{ 2/* |
3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 | 3 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 |
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) 9 * distributions including binary code include the above copyright notice and 10 * this paragraph in its entirety in the documentation or other materials 11 * provided with the distribution, and (3) all advertising materials mentioning --- 5 unchanged lines hidden (view full) --- 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[] = | 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) 9 * distributions including binary code include the above copyright notice and 10 * this paragraph in its entirety in the documentation or other materials 11 * provided with the distribution, and (3) all advertising materials mentioning --- 5 unchanged lines hidden (view full) --- 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: scanner.l,v 1.55 96/09/27 22:34:45 leres Exp $ (LBL)"; | 25 "@(#) $Header: scanner.l,v 1.56 97/07/21 13:31:50 leres Exp $ (LBL)"; |
26#endif 27 28#include <sys/types.h> 29#include <sys/time.h> 30 31#include <ctype.h> 32#include <unistd.h> 33 --- 100 unchanged lines hidden (view full) --- 134">=" return GEQ; 135"<=" return LEQ; 136"!=" return NEQ; 137"==" return '='; 138"<<" return LSH; 139">>" return RSH; 140{N} { yylval.i = stoi((char *)yytext); return NUM; } 141({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { | 26#endif 27 28#include <sys/types.h> 29#include <sys/time.h> 30 31#include <ctype.h> 32#include <unistd.h> 33 --- 100 unchanged lines hidden (view full) --- 134">=" return GEQ; 135"<=" return LEQ; 136"!=" return NEQ; 137"==" return '='; 138"<<" return LSH; 139">>" return RSH; 140{N} { yylval.i = stoi((char *)yytext); return NUM; } 141({N}\.{N})|({N}\.{N}\.{N})|({N}\.{N}\.{N}\.{N}) { |
142 yylval.s = sdup((char *)yytext); return HID; 143} | 142 yylval.s = sdup((char *)yytext); return HID; } |
144{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); 145 return EID; } 146{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } | 143{B}:{B}:{B}:{B}:{B}:{B} { yylval.e = pcap_ether_aton((char *)yytext); 144 return EID; } 145{B}:+({B}:+)+ { bpf_error("bogus ethernet address %s", yytext); } |
147[A-Za-z][-_.A-Za-z0-9]* { yylval.s = sdup((char *)yytext); return ID; } | 146[A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] { 147 yylval.s = sdup((char *)yytext); return ID; } |
148"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; } | 148"\\"[^ !()\n\t]+ { yylval.s = sdup((char *)yytext + 1); return ID; } |
149[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { bpf_error("illegal token: %s\n", yytext); } | 149[^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+i { 150 bpf_error("illegal token: %s\n", yytext); } |
150. { bpf_error("illegal char '%c'", *yytext); } 151%% 152void 153lex_init(buf) 154 char *buf; 155{ 156 in_buffer = buf; 157} --- 51 unchanged lines hidden --- | 151. { bpf_error("illegal char '%c'", *yytext); } 152%% 153void 154lex_init(buf) 155 char *buf; 156{ 157 in_buffer = buf; 158} --- 51 unchanged lines hidden --- |