db_lex.c (273006) | db_lex.c (299970) |
---|---|
1/*- 2 * Mach Operating System 3 * Copyright (c) 1991,1990 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the --- 18 unchanged lines hidden (view full) --- 27 * Author: David B. Golub, Carnegie Mellon University 28 * Date: 7/90 29 */ 30/* 31 * Lexical analyzer. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Mach Operating System 3 * Copyright (c) 1991,1990 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the --- 18 unchanged lines hidden (view full) --- 27 * Author: David B. Golub, Carnegie Mellon University 28 * Date: 7/90 29 */ 30/* 31 * Lexical analyzer. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/ddb/db_lex.c 273006 2014-10-12 18:01:52Z pfg $"); | 35__FBSDID("$FreeBSD: head/sys/ddb/db_lex.c 299970 2016-05-16 19:42:38Z pfg $"); |
36 37#include <sys/param.h> 38#include <sys/libkern.h> 39 40#include <ddb/ddb.h> 41#include <ddb/db_lex.h> 42 43static char db_line[DB_MAXLINE]; --- 225 unchanged lines hidden (view full) --- 269 return (tDOTDOT); 270 db_unread_char(c); 271 return (tDOT); 272 case '*': 273 return (tSTAR); 274 case '/': 275 return (tSLASH); 276 case '=': | 36 37#include <sys/param.h> 38#include <sys/libkern.h> 39 40#include <ddb/ddb.h> 41#include <ddb/db_lex.h> 42 43static char db_line[DB_MAXLINE]; --- 225 unchanged lines hidden (view full) --- 269 return (tDOTDOT); 270 db_unread_char(c); 271 return (tDOT); 272 case '*': 273 return (tSTAR); 274 case '/': 275 return (tSLASH); 276 case '=': |
277 c = db_read_char(); 278 if (c == '=') 279 return (tLOG_EQ); 280 db_unread_char(c); |
|
277 return (tEQ); 278 case '%': 279 return (tPCT); 280 case '#': 281 return (tHASH); 282 case '(': 283 return (tLPAREN); 284 case ')': 285 return (tRPAREN); 286 case ',': 287 return (tCOMMA); 288 case '"': 289 return (tDITTO); 290 case '$': 291 return (tDOLLAR); 292 case '!': | 281 return (tEQ); 282 case '%': 283 return (tPCT); 284 case '#': 285 return (tHASH); 286 case '(': 287 return (tLPAREN); 288 case ')': 289 return (tRPAREN); 290 case ',': 291 return (tCOMMA); 292 case '"': 293 return (tDITTO); 294 case '$': 295 return (tDOLLAR); 296 case '!': |
297 c = db_read_char(); 298 if (c == '='){ 299 return (tLOG_NOT_EQ); 300 } 301 db_unread_char(c); |
|
293 return (tEXCL); 294 case ';': 295 return (tSEMI); | 302 return (tEXCL); 303 case ';': 304 return (tSEMI); |
305 case '&': 306 c = db_read_char(); 307 if (c == '&') 308 return (tLOG_AND); 309 db_unread_char(c); 310 return (tBIT_AND); 311 case '|': 312 c = db_read_char(); 313 if (c == '|') 314 return (tLOG_OR); 315 db_unread_char(c); 316 return (tBIT_OR); |
|
296 case '<': 297 c = db_read_char(); 298 if (c == '<') 299 return (tSHIFT_L); | 317 case '<': 318 c = db_read_char(); 319 if (c == '<') 320 return (tSHIFT_L); |
321 if (c == '=') 322 return (tLESS_EQ); |
|
300 db_unread_char(c); | 323 db_unread_char(c); |
301 break; | 324 return (tLESS); |
302 case '>': 303 c = db_read_char(); 304 if (c == '>') 305 return (tSHIFT_R); | 325 case '>': 326 c = db_read_char(); 327 if (c == '>') 328 return (tSHIFT_R); |
329 if (c == '=') 330 return (tGREATER_EQ); |
|
306 db_unread_char(c); | 331 db_unread_char(c); |
307 break; | 332 return (tGREATER); 333 case '?': 334 return (tQUESTION); 335 case '~': 336 return (tBIT_NOT); |
308 case -1: 309 return (tEOF); 310 } 311 db_printf("Bad character\n"); 312 db_flush_lex(); 313 return (tEOF); 314} | 337 case -1: 338 return (tEOF); 339 } 340 db_printf("Bad character\n"); 341 db_flush_lex(); 342 return (tEOF); 343} |