forked from eugenechevski/CodeGeneratorSPL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexer.h
More file actions
executable file
·39 lines (30 loc) · 1.11 KB
/
lexer.h
File metadata and controls
executable file
·39 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* $Id: lexer.h,v 1.3 2024/10/23 13:38:20 leavens Exp $ */
#ifndef _LEXER_H
#define _LEXER_H
#include <stdbool.h>
// Requires: fname != NULL
// Requires: fname is the name of a readable file
// Initialize the lexer and start it reading
// from the given file name
extern void lexer_init(char *fname);
// Return the next token in the input
extern int yylex();
// Return the name of the current file
extern const char *lexer_filename();
// Return the line number of the next token
extern unsigned int lexer_line();
// On standard output:
// Print a message about the file name of the lexer's input
// and then print a heading for the lexer's output.
extern void lexer_print_output_header();
// Have any errors been noted by the lexer?
extern bool lexer_has_errors();
// Print information about the token t to stdout
// followed by a newline
extern void lexer_print_token(int t, unsigned int tline,
const char *txt);
/* Read all the tokens from the input file
* and print each token on standard output
* using the format in lexer_print_token */
extern void lexer_output();
#endif