4 * Lexial scanning of configuration files, used by parsers.
10 Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of
15 the License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public
23 License along with this program; if not, write to the Free
24 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
32 /* Lex get_char() return values */
39 /* Tokens returned by get_token() */
43 #define T_IDENTIFIER 104
45 #define T_QUOTED_STRING 106
46 #define T_BOB 108 /* begin block */
47 #define T_EOB 109 /* end of block */
66 /* Lex scan options */
67 #define LOPT_NO_IDENT 0x1 /* No Identifiers -- use string */
70 typedef struct s_lex_context {
71 int options; /* scan options */
72 char *fname; /* filename */
73 FILE *fd; /* file descriptor */
74 char line[MAXSTRING]; /* input line */
75 char str[MAXSTRING]; /* string being scanned */
76 int str_len; /* length of string */
77 int line_no; /* file line number */
78 int col_no; /* char position on line */
79 enum lex_state state; /* lex_state variable */
80 int ch; /* last char/L_VAL returned by get_char */
82 struct s_lex_context *next; /* pointer to next lexical context */