/* -*-c-*-
*
- * $Id: scan.h,v 1.2 1999/07/26 23:24:33 mdw Exp $
- *
* Character scanners
*
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
- * This file is part of the `fw' port forwarder.
+ * This file is part of the `fwd' port forwarder.
*
- * `fw' is free software; you can redistribute it and/or modify
+ * `fwd' is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
- * `fw' is distributed in the hope that it will be useful,
+ *
+ * `fwd' is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
- * along with `fw'; if not, write to the Free Software Foundation,
+ * along with `fwd'; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: scan.h,v $
- * Revision 1.2 1999/07/26 23:24:33 mdw
- * Complete rewrite. Allow a list of character sources to enable changes
- * during parsing of syntactic constructs.
- *
- * Revision 1.1.1.1 1999/07/01 08:56:23 mdw
- * Initial revision.
- *
- */
-
#ifndef SCAN_H
#define SCAN_H
struct scansrc_ops *ops; /* Pointer to operations table */
char *src; /* Name of this source */
int line; /* Current line number */
- int pushback; /* Pushback character */
+ dstr pushback; /* Pushback characters */
char *tok; /* Token pushback */
unsigned t; /* Token type pushback */
} scansrc;
scansrc *head, **tail; /* Scanner list head and tail */
int t; /* Token type */
dstr d; /* Current token value */
+ const char *wbegin, *wcont; /* Parsing exception strings */
} scanner;
/*----- Particular scanner types ------------------------------------------*/
/* --- @scan_file@ --- *
*
* Arguments: @FILE *fp@ = pointer to file descriptor
- * @char *name@ = pointer to source file name
+ * @const char *name@ = pointer to source file name
* @unsigned f@ = flags
*
* Returns: A scanner source.
* Use: Creates a new scanner source for reading from a file.
*/
-extern scansrc *scan_file(FILE */*fp*/, char */*name*/, unsigned /*f*/);
+#define SCF_NOCLOSE 1u /* Don't close @fp@ when finished */
-#define SCF_NOCLOSE 1u
-#define SCF_FREENAME 2u
+extern scansrc *scan_file(FILE */*fp*/, const char */*name*/,
+ unsigned /*f*/);
/* --- @scan_argv@ --- *
*
* Use: Scans a character from a source of characters.
*/
-extern int scan(scanner */*sc*/);
+extern int scan(scanner */*sc*/);
/* --- @unscan@ --- *
*