1 %{ 2 /* 3 * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved. 4 * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. 5 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 6 * 7 * This software is available to you under a choice of one of two 8 * licenses. You may choose to be licensed under the terms of the GNU 9 * General Public License (GPL) Version 2, available from the file 10 * COPYING in the main directory of this source tree, or the 11 * OpenIB.org BSD license below: 12 * 13 * Redistribution and use in source and binary forms, with or 14 * without modification, are permitted provided that the following 15 * conditions are met: 16 * 17 * - Redistributions of source code must retain the above 18 * copyright notice, this list of conditions and the following 19 * disclaimer. 20 * 21 * - Redistributions in binary form must reproduce the above 22 * copyright notice, this list of conditions and the following 23 * disclaimer in the documentation and/or other materials 24 * provided with the distribution. 25 * 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 * SOFTWARE. 34 * 35 */ 36 37 /* 38 * Abstract: 39 * Lexer of OSM QoS parser. 40 * 41 * Environment: 42 * Linux User Mode 43 * 44 * Author: 45 * Yevgeny Kliteynik, Mellanox 46 */ 47 48 #include <opensm/osm_file_ids.h> 49 #define FILE_ID OSM_FILE_QOS_PARSER_L_L 50 #include <opensm/osm_qos_policy.h> 51 #include "osm_qos_parser_y.h" 52 53 #define HANDLE_IF_IN_DESCRIPTION if (in_description) { yylval = strdup(yytext); return TK_TEXT; } 54 55 #define SAVE_POS save_pos() 56 static void save_pos(); 57 58 extern int column_num; 59 extern int line_num; 60 extern FILE * yyin; 61 extern YYSTYPE yylval; 62 63 boolean_t in_description = FALSE; 64 boolean_t in_list_of_hex_num_ranges = FALSE; 65 boolean_t in_node_type = FALSE; 66 boolean_t in_list_of_numbers = FALSE; 67 boolean_t in_list_of_strings = FALSE; 68 boolean_t in_list_of_num_pairs = FALSE; 69 boolean_t in_asterisk_or_list_of_numbers = FALSE; 70 boolean_t in_list_of_num_ranges = FALSE; 71 boolean_t in_single_string = FALSE; 72 boolean_t in_single_number = FALSE; 73 74 static void reset_new_line_flags(); 75 #define RESET_NEW_LINE_FLAGS reset_new_line_flags() 76 77 #define START_USE {in_description = TRUE;} /* list of strings including whitespace (description) */ 78 #define START_PORT_GUID {in_list_of_hex_num_ranges = TRUE;} /* comma-separated list of hex num ranges */ 79 #define START_PORT_NAME {in_list_of_strings = TRUE;} /* comma-separated list of following strings: ../../.. */ 80 #define START_PARTITION {in_single_string = TRUE;} /* single string w/o whitespaces (partition name) */ 81 #define START_NAME {in_single_string = TRUE;} /* single string w/o whitespaces (port group name) */ 82 #define START_QOS_LEVEL_NAME {in_single_string = TRUE;} /* single string w/o whitespaces (qos level name in match rule) */ 83 84 #define START_NODE_TYPE {in_node_type = TRUE;} /* comma-separated list of node types (ROUTER,CA,...) */ 85 #define START_SL2VL_TABLE {in_list_of_numbers = TRUE;} /* comma-separated list of hex or dec numbers */ 86 87 #define START_GROUP {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */ 88 #define START_ACROSS {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */ 89 #define START_ACROSS_TO {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */ 90 #define START_ACROSS_FROM {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */ 91 #define START_SOURCE {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */ 92 #define START_DESTINATION {in_list_of_strings = TRUE;} /* list of strings w/o whitespaces (group names) */ 93 94 #define START_VLARB_HIGH {in_list_of_num_pairs = TRUE;} /* comma-separated list of hex or dec num pairs: "num1:num2" */ 95 #define START_VLARB_LOW {in_list_of_num_pairs = TRUE;} /* comma-separated list of hex or dec num pairs: "num1:num2" */ 96 97 #define START_TO {in_asterisk_or_list_of_numbers = TRUE;} /* (asterisk) or (comma-separated list of hex or dec numbers) */ 98 #define START_FROM {in_asterisk_or_list_of_numbers = TRUE;} /* (asterisk) or (comma-separated list of hex or dec numbers) */ 99 100 #define START_PATH_BITS {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 101 #define START_QOS_CLASS {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 102 #define START_SERVICE_ID {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 103 #define START_PKEY {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 104 105 #define START_SL {in_single_number = TRUE;} /* single number */ 106 #define START_VLARB_HIGH_LIMIT {in_single_number = TRUE;} /* single number */ 107 #define START_MTU_LIMIT {in_single_number = TRUE;} /* single number */ 108 #define START_RATE_LIMIT {in_single_number = TRUE;} /* single number */ 109 #define START_PACKET_LIFE {in_single_number = TRUE;} /* single number */ 110 111 #define START_ULP_DEFAULT {in_single_number = TRUE;} /* single number */ 112 #define START_ULP_ANY {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 113 #define START_ULP_SDP_DEFAULT {in_single_number = TRUE;} /* single number */ 114 #define START_ULP_SDP_PORT {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 115 #define START_ULP_RDS_DEFAULT {in_single_number = TRUE;} /* single number */ 116 #define START_ULP_RDS_PORT {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 117 #define START_ULP_ISER_DEFAULT {in_single_number = TRUE;} /* single number */ 118 #define START_ULP_ISER_PORT {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 119 #define START_ULP_SRP_GUID {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 120 #define START_ULP_IPOIB_DEFAULT {in_single_number = TRUE;} /* single number */ 121 #define START_ULP_IPOIB_PKEY {in_list_of_num_ranges = TRUE;} /* comma-separated list of hex or dec num ranges */ 122 123 124 %} 125 126 %option nounput noinput 127 128 QOS_ULPS_START qos\-ulps 129 QOS_ULPS_END end\-qos\-ulps 130 PORT_GROUPS_START port\-groups 131 PORT_GROUPS_END end\-port\-groups 132 PORT_GROUP_START port\-group 133 PORT_GROUP_END end\-port\-group 134 PORT_NUM port\-num 135 NAME name 136 USE use 137 PORT_GUID port\-guid 138 TARGET_PORT_GUID target\-port\-guid 139 SOURCE_PORT_GUID source\-port\-guid 140 SOURCE_TARGET_PORT_GUID source\-target\-port\-guid 141 PORT_NAME port\-name 142 PARTITION partition 143 NODE_TYPE node\-type 144 QOS_SETUP_START qos\-setup 145 QOS_SETUP_END end\-qos\-setup 146 VLARB_TABLES_START vlarb\-tables 147 VLARB_TABLES_END end\-vlarb\-tables 148 VLARB_SCOPE_START vlarb\-scope 149 VLARB_SCOPE_END end\-vlarb\-scope 150 GROUP group 151 ACROSS across 152 VLARB_HIGH vlarb\-high 153 VLARB_LOW vlarb\-low 154 VLARB_HIGH_LIMIT vl\-high\-limit 155 SL2VL_TABLES_START sl2vl\-tables 156 SL2VL_TABLES_END end\-sl2vl\-tables 157 SL2VL_SCOPE_START sl2vl\-scope 158 SL2VL_SCOPE_END end\-sl2vl\-scope 159 TO to 160 FROM from 161 ACROSS_TO across\-to 162 ACROSS_FROM across\-from 163 SL2VL_TABLE sl2vl\-table 164 QOS_LEVELS_START qos\-levels 165 QOS_LEVELS_END end\-qos\-levels 166 QOS_LEVEL_START qos\-level 167 QOS_LEVEL_END end\-qos\-level 168 SL sl 169 MTU_LIMIT mtu\-limit 170 RATE_LIMIT rate\-limit 171 PACKET_LIFE packet\-life 172 PATH_BITS path\-bits 173 QOS_MATCH_RULES_START qos\-match\-rules 174 QOS_MATCH_RULES_END end\-qos\-match\-rules 175 QOS_MATCH_RULE_START qos\-match\-rule 176 QOS_MATCH_RULE_END end\-qos\-match\-rule 177 QOS_CLASS qos\-class 178 SOURCE source 179 DESTINATION destination 180 SERVICE_ID service\-id 181 PKEY pkey 182 QOS_LEVEL_NAME qos\-level\-name 183 184 ROUTER [Rr][Oo][Uu][Tt][Ee][Rr] 185 CA [Cc][Aa] 186 SWITCH [Ss][Ww][Ii][Tt][Cc][Hh] 187 SELF [Ss][Ee][Ll][Ff] 188 ALL [Aa][Ll][Ll] 189 190 ULP_SDP [Ss][Dd][Pp] 191 ULP_SRP [Ss][Rr][Pp] 192 ULP_RDS [Rr][Dd][Ss] 193 ULP_IPOIB [Ii][Pp][Oo][Ii][Bb] 194 ULP_ISER [Ii][Ss][Ee][Rr] 195 ULP_ANY [Aa][Nn][Yy] 196 ULP_DEFAULT [Dd][Ee][Ff][Aa][Uu][Ll][Tt] 197 198 WHITE [ \t]+ 199 NEW_LINE \n 200 COMMENT \#.*\n 201 WHITE_DOTDOT_WHITE [ \t]*:[ \t]* 202 WHITE_COMMA_WHITE [ \t]*,[ \t]* 203 QUOTED_TEXT \"[^\"]*\" 204 205 %% 206 207 208 {COMMENT} { SAVE_POS; RESET_NEW_LINE_FLAGS; } /* swallow comment */ 209 {WHITE}{NEW_LINE} { SAVE_POS; RESET_NEW_LINE_FLAGS; } /* trailing blanks with new line */ 210 {WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; } 211 {NEW_LINE} { SAVE_POS; RESET_NEW_LINE_FLAGS; } 212 213 {QOS_ULPS_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_START; } 214 {QOS_ULPS_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_ULPS_END; } 215 216 {PORT_GROUPS_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_START; } 217 {PORT_GROUPS_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUPS_END; } 218 {PORT_GROUP_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_START; } 219 {PORT_GROUP_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_PORT_GROUP_END; } 220 221 {QOS_SETUP_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_START; } 222 {QOS_SETUP_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_SETUP_END; } 223 {VLARB_TABLES_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_START; } 224 {VLARB_TABLES_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_TABLES_END; } 225 {VLARB_SCOPE_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_START; } 226 {VLARB_SCOPE_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_VLARB_SCOPE_END; } 227 228 {SL2VL_TABLES_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_START; } 229 {SL2VL_TABLES_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_TABLES_END; } 230 {SL2VL_SCOPE_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_START; } 231 {SL2VL_SCOPE_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_SL2VL_SCOPE_END; } 232 233 {QOS_LEVELS_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_START; } 234 {QOS_LEVELS_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVELS_END; } 235 {QOS_LEVEL_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_START; } 236 {QOS_LEVEL_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_LEVEL_END; } 237 238 {QOS_MATCH_RULES_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_START; } 239 {QOS_MATCH_RULES_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULES_END; } 240 {QOS_MATCH_RULE_START} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_START; } 241 {QOS_MATCH_RULE_END} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; return TK_QOS_MATCH_RULE_END; } 242 243 {PORT_GUID}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_GUID; return TK_PORT_GUID; } 244 {PORT_NAME}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PORT_NAME; return TK_PORT_NAME; } 245 {PARTITION}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PARTITION; return TK_PARTITION; } 246 {NODE_TYPE}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NODE_TYPE; return TK_NODE_TYPE; } 247 {NAME}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_NAME; return TK_NAME; } 248 {USE}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_USE; return TK_USE; } 249 {GROUP}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_GROUP; return TK_GROUP; } 250 {VLARB_HIGH}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH; return TK_VLARB_HIGH; } 251 {VLARB_LOW}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_LOW; return TK_VLARB_LOW; } 252 {VLARB_HIGH_LIMIT}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_VLARB_HIGH_LIMIT; return TK_VLARB_HIGH_LIMIT;} 253 {TO}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_TO; return TK_TO; } 254 {FROM}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_FROM; return TK_FROM; } 255 {ACROSS_TO}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_TO; return TK_ACROSS_TO; } 256 {ACROSS_FROM}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS_FROM; return TK_ACROSS_FROM;} 257 {ACROSS}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ACROSS; return TK_ACROSS; } 258 {SL2VL_TABLE}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL2VL_TABLE; return TK_SL2VL_TABLE;} 259 {SL}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SL; return TK_SL; } 260 {MTU_LIMIT}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_MTU_LIMIT; return TK_MTU_LIMIT; } 261 {RATE_LIMIT}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_RATE_LIMIT; return TK_RATE_LIMIT; } 262 {PACKET_LIFE}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PACKET_LIFE; return TK_PACKET_LIFE;} 263 {PATH_BITS}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PATH_BITS; return TK_PATH_BITS; } 264 {QOS_CLASS}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_CLASS; return TK_QOS_CLASS; } 265 {SOURCE}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SOURCE; return TK_SOURCE; } 266 {DESTINATION}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_DESTINATION; return TK_DESTINATION;} 267 {SERVICE_ID}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_SERVICE_ID; return TK_SERVICE_ID; } 268 {PKEY}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_PKEY; return TK_PKEY; } 269 {QOS_LEVEL_NAME}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_QOS_LEVEL_NAME; return TK_QOS_LEVEL_NAME;} 270 271 {ROUTER} { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ROUTER; yylval = strdup(yytext); return TK_TEXT; } 272 {CA} { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_CA; yylval = strdup(yytext); return TK_TEXT; } 273 {SWITCH} { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SWITCH; yylval = strdup(yytext); return TK_TEXT; } 274 {SELF} { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_SELF; yylval = strdup(yytext); return TK_TEXT; } 275 {ALL} { SAVE_POS; if (in_node_type) return TK_NODE_TYPE_ALL; yylval = strdup(yytext); return TK_TEXT; } 276 277 {ULP_DEFAULT}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_DEFAULT; return TK_ULP_DEFAULT; } 278 {ULP_ANY}{WHITE_COMMA_WHITE}{SERVICE_ID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SERVICE_ID; } 279 {ULP_ANY}{WHITE_COMMA_WHITE}{PKEY} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_PKEY; } 280 {ULP_ANY}{WHITE_COMMA_WHITE}{TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_TARGET_PORT_GUID; } 281 {ULP_ANY}{WHITE_COMMA_WHITE}{SOURCE_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SOURCE_PORT_GUID; } 282 {ULP_ANY}{WHITE_COMMA_WHITE}{SOURCE_TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_ANY; return TK_ULP_ANY_SOURCE_TARGET_PORT_GUID; } 283 284 {ULP_SDP}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_SDP_DEFAULT; } 285 {ULP_SDP}{WHITE_COMMA_WHITE}{PORT_NUM} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_SDP_PORT; } 286 287 {ULP_RDS}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_DEFAULT; return TK_ULP_RDS_DEFAULT; } 288 {ULP_RDS}{WHITE_COMMA_WHITE}{PORT_NUM} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_RDS_PORT; return TK_ULP_RDS_PORT; } 289 290 {ULP_ISER}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_DEFAULT; return TK_ULP_ISER_DEFAULT; } 291 {ULP_ISER}{WHITE_COMMA_WHITE}{PORT_NUM} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SDP_PORT; return TK_ULP_ISER_PORT; } 292 293 {ULP_SRP}{WHITE_COMMA_WHITE}{TARGET_PORT_GUID} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_SRP_GUID; return TK_ULP_SRP_GUID; } 294 295 {ULP_IPOIB}{WHITE_DOTDOT_WHITE} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_DEFAULT; return TK_ULP_IPOIB_DEFAULT; } 296 {ULP_IPOIB}{WHITE_COMMA_WHITE}{PKEY} { SAVE_POS; HANDLE_IF_IN_DESCRIPTION; START_ULP_IPOIB_PKEY; return TK_ULP_IPOIB_PKEY; } 297 298 0[xX][0-9a-fA-F]+ { 299 SAVE_POS; 300 yylval = strdup(yytext); 301 if (in_description || in_list_of_strings || in_single_string) 302 return TK_TEXT; 303 return TK_NUMBER; 304 } 305 306 [0-9]+ { 307 SAVE_POS; 308 yylval = strdup(yytext); 309 if (in_description || in_list_of_strings || in_single_string) 310 return TK_TEXT; 311 return TK_NUMBER; 312 } 313 314 315 - { 316 SAVE_POS; 317 if (in_description || in_list_of_strings || in_single_string) 318 { 319 yylval = strdup(yytext); 320 return TK_TEXT; 321 } 322 return TK_DASH; 323 } 324 325 : { 326 SAVE_POS; 327 if (in_description || in_list_of_strings || in_single_string) 328 { 329 yylval = strdup(yytext); 330 return TK_TEXT; 331 } 332 return TK_DOTDOT; 333 } 334 335 , { 336 SAVE_POS; 337 if (in_description) 338 { 339 yylval = strdup(yytext); 340 return TK_TEXT; 341 } 342 return TK_COMMA; 343 } 344 345 \* { 346 SAVE_POS; 347 if (in_description || in_list_of_strings || in_single_string) 348 { 349 yylval = strdup(yytext); 350 return TK_TEXT; 351 } 352 return TK_ASTERISK; 353 } 354 355 {QUOTED_TEXT} { 356 SAVE_POS; 357 yylval = strdup(&yytext[1]); 358 yylval[strlen(yylval)-1] = '\0'; 359 return TK_TEXT; 360 } 361 362 . { SAVE_POS; yylval = strdup(yytext); return TK_TEXT;} 363 364 <<EOF>> { 365 YY_NEW_FILE; 366 yyterminate(); 367 } 368 %% 369 370 371 /********************************************* 372 *********************************************/ 373 374 static void save_pos() 375 { 376 int i; 377 for (i = 0; i < yyleng; i++) 378 { 379 if (yytext[i] == '\n') 380 { 381 line_num ++; 382 column_num = 1; 383 } 384 else 385 column_num ++; 386 } 387 } 388 389 /********************************************* 390 *********************************************/ 391 392 static void reset_new_line_flags() 393 { 394 in_description = FALSE; 395 in_list_of_hex_num_ranges = FALSE; 396 in_node_type = FALSE; 397 in_list_of_numbers = FALSE; 398 in_list_of_strings = FALSE; 399 in_list_of_num_pairs = FALSE; 400 in_asterisk_or_list_of_numbers = FALSE; 401 in_list_of_num_ranges = FALSE; 402 in_single_string = FALSE; 403 in_single_number = FALSE; 404 } 405