|
|
1.1 root 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
9: * software, derivative works or modified versions, and any portions
10: * thereof, and that both notices appear in supporting documentation.
11: *
12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15: *
16: * Carnegie Mellon requests users of this software to return to
17: *
18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
22: *
23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: * Author: David B. Golub, Carnegie Mellon University
28: * Date: 7/90
29: */
30: /*
31: * Lexical analyzer.
32: */
33:
34: #define TOK_STRING_SIZE 64
35: #define DB_LEX_LINE_SIZE 256
36:
37: struct db_lex_context {
38: int l_char; /* peek char */
39: int l_token; /* peek token */
40: char *l_ptr; /* line pointer */
41: char *l_eptr; /* line end pointer */
42: };
43:
44: extern int db_read_line(/* char *rep_str */);
45: extern void db_flush_line();
46: extern int db_read_char();
47: extern void db_unread_char(/* char c */);
48: extern int db_read_token();
49: extern void db_unread_token(/* int t */);
50: extern void db_flush_lex();
51: extern void db_switch_input(/* char *, int */);
52: extern void db_save_lex_context(/* struct db_lex_context * */);
53: extern void db_restore_lex_context(/* struct db_lex_context * */);
54: extern void db_skip_to_eol();
55:
56: extern db_expr_t db_tok_number;
57: extern char db_tok_string[TOK_STRING_SIZE];
58: extern db_expr_t db_radix;
59:
60: #define tEOF (-1)
61: #define tEOL 1
62: #define tNUMBER 2
63: #define tIDENT 3
64: #define tPLUS 4
65: #define tMINUS 5
66: #define tDOT 6
67: #define tSTAR 7
68: #define tSLASH 8
69: #define tEQ 9
70: #define tLPAREN 10
71: #define tRPAREN 11
72: #define tPCT 12
73: #define tHASH 13
74: #define tCOMMA 14
75: #define tQUOTE 15
76: #define tDOLLAR 16
77: #define tEXCL 17
78: #define tSHIFT_L 18
79: #define tSHIFT_R 19
80: #define tDOTDOT 20
81: #define tSEMI_COLON 21
82: #define tLOG_EQ 22
83: #define tLOG_NOT_EQ 23
84: #define tLESS 24
85: #define tLESS_EQ 25
86: #define tGREATER 26
87: #define tGREATER_EQ 27
88: #define tBIT_AND 28
89: #define tBIT_OR 29
90: #define tLOG_AND 30
91: #define tLOG_OR 31
92: #define tSTRING 32
93: #define tQUESTION 33
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.