Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: lexer.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | /* | |
24 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | |
25 | * Use is subject to license terms. | |
26 | */ | |
27 | #pragma ident "@(#)lexer.h 1.7 06/10/06 SMI" | |
28 | ||
29 | #ifndef _LEXER_TOKENS_H_ | |
30 | #define _LEXER_TOKENS_H_ | |
31 | ||
32 | #ifdef __cplusplus | |
33 | extern "C" { | |
34 | #endif | |
35 | ||
36 | typedef enum { | |
37 | T_EOF, | |
38 | T_L_Brace, | |
39 | T_R_Brace, | |
40 | T_S_Colon, | |
41 | T_Plus, | |
42 | T_Minus, | |
43 | T_Comma, | |
44 | T_Number, | |
45 | T_HexString, | |
46 | T_String, | |
47 | T_Token, | |
48 | T_Amp, | |
49 | T_Error | |
50 | } lexer_tok_t; | |
51 | ||
52 | typedef struct { | |
53 | int linenum; | |
54 | char * fnamep; | |
55 | char * cleanup_filep; | |
56 | uint64_t val; | |
57 | char * strp; | |
58 | bool_t ungot_available; | |
59 | lexer_tok_t last_token; | |
60 | } lexer_t; | |
61 | ||
62 | extern lexer_t lex; | |
63 | ||
64 | void init_lexer(char * fnamep, FILE * fp, char * cleanup_filep); | |
65 | lexer_tok_t lex_get_token(); | |
66 | void lex_get(lexer_tok_t expected); | |
67 | void lex_unget(); | |
68 | void lex_fatal(char * s, ...); | |
69 | ||
70 | ||
71 | #ifdef __cplusplus | |
72 | } | |
73 | #endif | |
74 | ||
75 | #endif /* _LEXER_TOKENS_H_ */ |