]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/lex.h
Replace explicit checks for "/" with calls to IsPathSeparator, strchr with first_path...
[bacula/bacula] / bacula / src / lib / lex.h
index f063797be637268d2aa0ce3fa958b8302613e4bf..b91bdbfefc8ffd03aee1f9b8c951ae8a78cb2944 100644 (file)
@@ -1,69 +1,79 @@
 /*
- *   lex.h  
+ *   lex.h
  *
  *    Lexical scanning of configuration files, used by parsers.
  *
- *   Kern Sibbald, MM  
+ *   Kern Sibbald, MM
  *
  *   Version $Id$
  *
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Bacula® - The Network Backup Solution
 
-   This program 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.
+   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
+
+   This program 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 this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
- */
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 
 #ifndef _LEX_H
 #define _LEX_H
 
 /* Lex get_char() return values */
-#define L_EOF                        (-1)
-#define L_EOL                        (-2)
+#define L_EOF                         (-1)
+#define L_EOL                         (-2)
 
 /* Internal tokens */
-#define T_NONE                       100                              
+#define T_NONE                        100
 
 /* Tokens returned by get_token() */
-#define T_EOF                        101
-#define T_NUMBER                     102
-#define T_IPADDR                     103
-#define T_IDENTIFIER                 104
-#define T_UNQUOTED_STRING            105
-#define T_QUOTED_STRING              106
-#define T_BOB                        108  /* begin block */
-#define T_EOB                        109  /* end of block */
-#define T_EQUALS                     110
-#define T_COMMA                      111
-#define T_EOL                        112
-#define T_SEMI                       113
-#define T_ERROR                      200
+#define T_EOF                         101
+#define T_NUMBER                      102
+#define T_IPADDR                      103
+#define T_IDENTIFIER                  104
+#define T_UNQUOTED_STRING             105
+#define T_QUOTED_STRING               106
+#define T_BOB                         108  /* begin block */
+#define T_EOB                         109  /* end of block */
+#define T_EQUALS                      110
+#define T_COMMA                       111
+#define T_EOL                         112
+#define T_ERROR                       200
+#define T_UNICODE_MARK                201
+
 /*
  * The following will be returned only if
- * the appropriate expect flag has been set   
+ * the appropriate expect flag has been set
  */
-#define T_PINT32                     114  /* positive integer */
-#define T_PINT32_RANGE               115  /* positive integer range */
-#define T_INT32                      116  /* integer */
-#define T_INT64                      117  /* 64 bit integer */
-#define T_NAME                       118  /* name max 128 chars */
-#define T_STRING                     119  /* string */
+#define T_SKIP_EOL                    113  /* scan through EOLs */
+#define T_PINT32                      114  /* positive integer */
+#define T_PINT32_RANGE                115  /* positive integer range */
+#define T_INT32                       116  /* integer */
+#define T_INT64                       117  /* 64 bit integer */
+#define T_NAME                        118  /* name max 128 chars */
+#define T_STRING                      119  /* string */
 
-#define T_ALL                          0  /* no expectations */
+#define T_ALL                           0  /* no expectations */
 
 /* Lexical state */
 enum lex_state {
@@ -74,36 +84,39 @@ enum lex_state {
    lex_identifier,
    lex_string,
    lex_quoted_string,
-   lex_include
+   lex_include,
+   lex_unicode_mark
 };
 
 /* Lex scan options */
-#define LOPT_NO_IDENT           0x1  /* No Identifiers -- use string */
+#define LOPT_NO_IDENT            0x1  /* No Identifiers -- use string */
+#define LOPT_STRING              0x2  /* Force scan for string */
 
 /* Lexical context */
 typedef struct s_lex_context {
-   struct s_lex_context *next;       /* pointer to next lexical context */
-   int options;                      /* scan options */
-   char *fname;                      /* filename */
-   FILE *fd;                         /* file descriptor */
-   char line[MAXSTRING];             /* input line */
-   char str[MAXSTRING];              /* string being scanned */
-   int str_len;                      /* length of string */
-   int line_no;                      /* file line number */
-   int col_no;                       /* char position on line */
-   int begin_line_no;                /* line no of beginning of string */
-   enum lex_state state;             /* lex_state variable */
-   int ch;                           /* last char/L_VAL returned by get_char */
+   struct s_lex_context *next;        /* pointer to next lexical context */
+   int options;                       /* scan options */
+   char *fname;                       /* filename */
+   FILE *fd;                          /* file descriptor */
+   char line[MAXSTRING];              /* input line */
+   char str[MAXSTRING];               /* string being scanned */
+   int str_len;                       /* length of string */
+   int line_no;                       /* file line number */
+   int col_no;                        /* char position on line */
+   int begin_line_no;                 /* line no of beginning of string */
+   enum lex_state state;              /* lex_state variable */
+   int ch;                            /* last char/L_VAL returned by get_char */
    int token;
    uint32_t pint32_val;
    uint32_t pint32_val2;
    int32_t int32_val;
    int64_t int64_val;
-   void (*scan_error)(char *file, int line, struct s_lex_context *lc, char *msg, ...);
-   void *caller_ctx;                 /* caller private data */
+   void (*scan_error)(const char *file, int line, struct s_lex_context *lc, const char *msg, ...);
+   int err_type;                      /* message level for scan_error (M_..) */
+   void *caller_ctx;                  /* caller private data */
 } LEX;
 
-typedef void (LEX_ERROR_HANDLER)(char *file, int line, LEX *lc, char *msg, ...);
+typedef void (LEX_ERROR_HANDLER)(const char *file, int line, LEX *lc, const char *msg, ...);
 
 /* Lexical scanning errors in parsing conf files */
 #define scan_err0(lc, msg) lc->scan_error(__FILE__, __LINE__, lc, msg)
@@ -115,5 +128,6 @@ typedef void (LEX_ERROR_HANDLER)(char *file, int line, LEX *lc, char *msg, ...);
 #define scan_err6(lc, msg, a1, a2, a3, a4, a5, a6) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2, a3, a4, a5, a6)
 
 void scan_to_eol(LEX *lc);
+int scan_to_next_not_eol(LEX * lc);
 
 #endif /* _LEX_H */