|
|
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:
1.1.1.2 ! root 44: extern int db_lex(void);
! 45: extern int db_read_line(char *rep_str);
! 46: extern void db_flush_line(void);
! 47: extern int db_read_char(void);
! 48: extern void db_unread_char(int c);
! 49: extern int db_read_token(void);
! 50: extern void db_unread_token(int t);
! 51: extern void db_flush_lex(void);
! 52: extern void db_switch_input(char *, int);
! 53: extern void db_save_lex_context(struct db_lex_context *);
! 54: extern void db_restore_lex_context(struct db_lex_context *);
! 55: extern void db_skip_to_eol(void);
1.1 root 56:
57: extern db_expr_t db_tok_number;
58: extern char db_tok_string[TOK_STRING_SIZE];
59: extern db_expr_t db_radix;
60:
61: #define tEOF (-1)
62: #define tEOL 1
63: #define tNUMBER 2
64: #define tIDENT 3
65: #define tPLUS 4
66: #define tMINUS 5
67: #define tDOT 6
68: #define tSTAR 7
69: #define tSLASH 8
70: #define tEQ 9
71: #define tLPAREN 10
72: #define tRPAREN 11
73: #define tPCT 12
74: #define tHASH 13
75: #define tCOMMA 14
76: #define tQUOTE 15
77: #define tDOLLAR 16
78: #define tEXCL 17
79: #define tSHIFT_L 18
80: #define tSHIFT_R 19
81: #define tDOTDOT 20
82: #define tSEMI_COLON 21
83: #define tLOG_EQ 22
84: #define tLOG_NOT_EQ 23
85: #define tLESS 24
86: #define tLESS_EQ 25
87: #define tGREATER 26
88: #define tGREATER_EQ 27
89: #define tBIT_AND 28
90: #define tBIT_OR 29
91: #define tLOG_AND 30
92: #define tLOG_OR 31
93: #define tSTRING 32
94: #define tQUESTION 33
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.