0
|
1 %{
|
|
2 /*
|
|
3 * CDDL HEADER START
|
|
4 *
|
|
5 * The contents of this file are subject to the terms of the
|
|
6 * Common Development and Distribution License, Version 1.0 only
|
|
7 * (the "License"). You may not use this file except in compliance
|
|
8 * with the License.
|
|
9 *
|
|
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
11 * or http://www.opensolaris.org/os/licensing.
|
|
12 * See the License for the specific language governing permissions
|
|
13 * and limitations under the License.
|
|
14 *
|
|
15 * When distributing Covered Code, include this CDDL HEADER in each
|
|
16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
17 * If applicable, add the following below this CDDL HEADER, with the
|
|
18 * fields enclosed by brackets "[]" replaced with your own identifying
|
|
19 * information: Portions Copyright [yyyy] [name of copyright owner]
|
|
20 *
|
|
21 * CDDL HEADER END
|
|
22 *
|
|
23 * Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
|
|
24 * Use is subject to license terms.
|
|
25 */
|
|
26
|
|
27 #pragma ident "@(#)personal.l 1.8 05/06/12 SMI"
|
|
28
|
|
29 /*
|
|
30 #define DEBUG_LEX printf("\tLEX: %s(%d) at line %d\n", yytext, yyval, yylineno);
|
|
31 */
|
|
32 #define DEBUG_LEX
|
|
33
|
|
34
|
|
35 #define QUOTED_STRING_SIZE 100
|
|
36
|
|
37 static int lex_bug4163217 = 1;
|
|
38 static char quoted_string[QUOTED_STRING_SIZE];
|
|
39 static int token_value;
|
|
40
|
|
41 static void get_quoted_string();
|
|
42
|
|
43 %}
|
|
44
|
|
45 %%
|
|
46
|
|
47 #.*\n { ; }
|
|
48 [ \t\n]* { ; }
|
|
49 \" { get_quoted_string();
|
|
50 if (lex_bug4163217) return QUOTEDSTRING;
|
|
51 }
|
|
52
|
|
53 \{ { DEBUG_LEX if (lex_bug4163217) return OPENBRACKET; }
|
|
54 \} { DEBUG_LEX if (lex_bug4163217) return CLOSEBRACKET; }
|
|
55 \. { DEBUG_LEX if (lex_bug4163217) return DOT; }
|
|
56 = { DEBUG_LEX if (lex_bug4163217) return EQUAL; }
|
|
57 \, { DEBUG_LEX if (lex_bug4163217) return COMA; }
|
|
58 \[ { DEBUG_LEX if (lex_bug4163217) return OPENSQUAREBRACKET; }
|
|
59 \] { DEBUG_LEX if (lex_bug4163217) return CLOSESQUAREBRACKET; }
|
|
60 \- { DEBUG_LEX if (lex_bug4163217) return MINUS; }
|
|
61
|
|
62 [0-9]+ { DEBUG_LEX token_value = atoi(yytext);
|
|
63 if (lex_bug4163217) return NUMBER;
|
|
64 }
|
|
65
|
|
66 [mM][aA][cC][rR][oO][sS] { DEBUG_LEX if (lex_bug4163217) return MACROS; }
|
|
67 [aA][gG][eE][nN][tT][sS] { DEBUG_LEX if (lex_bug4163217) return AGENTS; }
|
|
68 [nN][aA][mM][eE] { DEBUG_LEX if (lex_bug4163217) return NAME; }
|
|
69 [sS][uU][bB][tT][rR][eE][eE][sS] { DEBUG_LEX if (lex_bug4163217) return SUBTREES; }
|
|
70 [tT][aA][bB][lL][eE][sS] { DEBUG_LEX if (lex_bug4163217) return TABLES; }
|
|
71 [tT][aA][bB][lL][eE] { DEBUG_LEX if (lex_bug4163217) return TABLE; }
|
|
72 [cC][oO][lL][uU][mM][nN][sS] { DEBUG_LEX if (lex_bug4163217) return COLUMNS; }
|
|
73 [iI][nN][dD][eE][xX][sS] { DEBUG_LEX if (lex_bug4163217) return INDEXS; }
|
|
74 [iI][nN][dD][eE][xX][eE][sS] { DEBUG_LEX if (lex_bug4163217) return INDEXS; }
|
|
75 [tT][iI][mM][eE][oO][uU][tT] { DEBUG_LEX if (lex_bug4163217) return TIMEOUT; }
|
|
76 [pP][oO][rR][tT] { DEBUG_LEX if (lex_bug4163217) return PORT; }
|
|
77 [wW][aA][tT][cC][hH][-_][dD][o0][gG][-_][tT][iI][mM][eE] { DEBUG_LEX if (lex_bug4163217) return WATCHDOGTIME; }
|
|
78
|
|
79 [cC][oO][mM][mM][uU][nN][iI][tT][iI][eE][sS] { DEBUG_LEX if (lex_bug4163217) return COMMUNITIES; }
|
|
80 [rR][eE][aA][dD][-][oO][nN][lL][yY] { DEBUG_LEX if (lex_bug4163217) return READONLY; }
|
|
81 [rR][eE][aA][dD][-][wW][rR][iI][tT][eE] { DEBUG_LEX if (lex_bug4163217) return READWRITE; }
|
|
82 [mM][aA][nN][aA][gG][eE][rR][sS] { DEBUG_LEX if (lex_bug4163217) return MANAGERS; }
|
|
83 [tT][rR][aA][pP] { DEBUG_LEX if (lex_bug4163217) return TRAP; }
|
|
84 [tT][rR][aA][pP][-][nN][uU][mM] { DEBUG_LEX if (lex_bug4163217) return TRAPNUM; }
|
|
85 [tT][rR][aA][pP][-][cC][oO][mM][mM][uU][nN][iI][tT][yY] { DEBUG_LEX if (lex_bug4163217) return TRAPCOMMUNITY; }
|
|
86 [tT][rR][aA][pP][-][rR][eE][cC][iI][pP][iI][eE][nN][tT][sS] { DEBUG_LEX if (lex_bug4163217) return TRAPDESTINATORS; }
|
|
87
|
|
88 [aA][cC][lL] { DEBUG_LEX if (lex_bug4163217) return ACL; }
|
|
89 [aA][cC][cC][eE][sS][sS] { DEBUG_LEX if (lex_bug4163217) return ACCESS; }
|
|
90 [hH][oO][sS][tT][sS] { DEBUG_LEX if (lex_bug4163217) return HOSTS; }
|
|
91
|
|
92 mib-2 { DEBUG_LEX if (lex_bug4163217) return MIB2; }
|
|
93 sun { DEBUG_LEX if (lex_bug4163217) return SUN; }
|
|
94 enterprise { DEBUG_LEX if (lex_bug4163217) return ENTERPRISE; }
|
|
95
|
|
96 [a-zA-Z\*][_a-zA-Z0-9-]* { DEBUG_LEX if (lex_bug4163217) return IDENTIFIER; }
|
|
97
|
|
98 . { error_exit("syntax error in %s at line %d: the token %s is not valid",
|
|
99 current_filename, yylineno, yytext);
|
|
100 }
|
|
101
|
|
102
|
|
103 %%
|
|
104
|
|
105 #undef input
|
|
106 #undef unput
|
|
107 #undef output
|
|
108
|
|
109 /*
|
|
110 # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
|
|
111 # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
|
|
112 # define output(c) (void)putc(c,yyout)
|
|
113 */
|
|
114
|
|
115 #define input() (((yytchar=*lexinput++)=='\n'?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
|
|
116 #define unput(c) {yytchar= (c); if(yytchar=='\n')yylineno--;*--lexinput = yytchar;}
|
|
117 #define output(c)
|
|
118
|
|
119 /*************************************************************************/
|
|
120
|
|
121 static void get_quoted_string()
|
|
122 {
|
|
123 int i = 0;
|
|
124 int c;
|
|
125
|
|
126
|
|
127 c = input();
|
|
128 while( (c != 0) && (c != '"') )
|
|
129 {
|
|
130 if(c == '\n')
|
|
131 {
|
|
132 error_exit("syntax error at line %d: can not have a \\n in a quoted string", yylineno);
|
|
133 }
|
|
134
|
|
135 if(i < QUOTED_STRING_SIZE - 1)
|
|
136 {
|
|
137 quoted_string[i++] = c;
|
|
138 }
|
|
139
|
|
140 c = input();
|
|
141 }
|
|
142 quoted_string[i] = '\0';
|
|
143
|
|
144 if(c == 0)
|
|
145 {
|
|
146 error_exit("syntax error at line %d: have not found a quote before the end of file", yylineno);
|
|
147 }
|
|
148 }
|
|
149
|
|
150
|