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