1 /* GNU Datamash - perform simple calculation on input data
2 
3    Copyright (C) 2013-2020 Assaf Gordon <assafgordon@gmail.com>
4 
5    This file is part of GNU Datamash.
6 
7    GNU Datamash is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    GNU Datamash is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with GNU Datamash.  If not, see <https://www.gnu.org/licenses/>.
19 */
20 
21 /* Written by Assaf Gordon */
22 #ifndef __OP_SCANNER_H__
23 #define __OP_SCANNER_H__
24 
25 #define MAX_IDENTIFIER_LENGTH 512
26 
27 enum TOKEN
28 {
29   TOK_END=0,
30   TOK_IDENTIFIER,
31   TOK_INTEGER,
32   TOK_FLOAT,
33   TOK_COMMA,
34   TOK_DASH,
35   TOK_COLONS,
36   TOK_WHITESPACE
37 };
38 
39 extern uintmax_t scan_val_int;
40 extern long double scan_val_float;
41 extern char* scanner_identifier;
42 extern bool scanner_keep_whitespace;
43 
44 /* Initialize the scanner from argc/argv pair.
45    note: argv should contain only the actual input: remove
46          any other program parameters (including progname/argv[0]) */
47 void
48 scanner_set_input_from_argv (int argc, const char* argv[]);
49 
50 /* Free any data/memory associated with the scanner */
51 void
52 scanner_free ();
53 
54 enum TOKEN
55 scanner_get_token ();
56 
57 enum TOKEN
58 scanner_peek_token ();
59 
60 #endif
61