Patches to make the LLVM sources more -pedantic clean. Patch provided
[oota-llvm.git] / tools / llvmc / ConfigLexer.h
1 //===- ConfigLexer.h - ConfigLexer Declarations -----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the types and data needed by ConfigLexer.l
11 //
12 //===------------------------------------------------------------------------===
13 #ifndef LLVM_TOOLS_LLVMC_CONFIGLEXER_H
14 #define LLVM_TOOLS_LLVMC_CONFIGLEXER_H
15
16 #include <string>
17 #include <istream>
18 #include <cassert>
19
20 namespace llvm {
21
22 struct ConfigLexerInfo
23 {
24   int64_t     IntegerVal;
25   std::string StringVal;
26   bool in_value;
27   unsigned lineNum;
28 };
29
30 extern ConfigLexerInfo ConfigLexerState;
31
32 class InputProvider {
33   public:
34     InputProvider(const std::string& nm) {
35       name = nm;
36       errCount = 0;
37     }
38     virtual ~InputProvider();
39     virtual unsigned read(char *buf, unsigned max_size) = 0;
40     virtual void error(const std::string& msg);
41     virtual void checkErrors();
42
43   private:
44     std::string name;
45     unsigned errCount;
46 };
47
48 extern InputProvider* ConfigLexerInput;
49
50 enum ConfigLexerTokens {
51   EOFTOK = 0,        ///< Returned by Configlex when we hit end of file
52   EOLTOK,            ///< End of line
53   ERRORTOK,          ///< Error token
54   ARGS_SUBST,        ///< The substitution item %args%
55   BINDIR_SUBST,      ///< The substitution item %bindir%
56   ASSEMBLY,          ///< The value "assembly" (and variants)
57   ASSEMBLER,         ///< The name "assembler" (and variants)
58   BYTECODE,          ///< The value "bytecode" (and variants)
59   COMMAND,           ///< The name "command" (and variants)
60   DEFS_SUBST,        ///< The substitution item %defs%
61   EQUALS,            ///< The equals sign, =
62   FALSETOK,          ///< A boolean false value (false/no/off)
63   FOPTS_SUBST,       ///< The substitution item %fOpts%
64   IN_SUBST,          ///< The substitution item %in%
65   INCLS_SUBST,       ///< The substitution item %incls%
66   INTEGER,           ///< An integer
67   LANG,              ///< The name "lang" (and variants)
68   LIBDIR_SUBST,      ///< The substitution item %libdir%
69   LIBPATHS,          ///< The name "libpaths" (and variants)
70   LIBS,              ///< The name "libs" (and variants)
71   LIBS_SUBST,        ///< The substitution item %libs%
72   LINKER,            ///< The name "linker" (and variants)
73   LLVMGCCDIR_SUBST,  ///< The substitution item %llvmgccdir%
74   LLVMGCCARCH_SUBST, ///< The substitution item %llvmgccarch%
75   LLVMGCC_SUBST,     ///< The substitution item %llvmgcc%
76   LLVMGXX_SUBST,     ///< The substitution item %llvmgxx%
77   LLVMCC1_SUBST,     ///< The substitution item %llvmcc1%
78   LLVMCC1PLUS_SUBST, ///< The substitution item %llvmcc1plus%
79   MOPTS_SUBST,       ///< The substitution item %Mopts%
80   NAME,              ///< The name "name" (and variants)
81   OPT_SUBST,         ///< The substitution item %opt%
82   OPTIMIZER,         ///< The name "optimizer" (and variants)
83   OPTION,            ///< A command line option
84   OPT1,              ///< The name "opt1" (and variants)
85   OPT2,              ///< The name "opt2" (and variants)
86   OPT3,              ///< The name "opt3" (and variants)
87   OPT4,              ///< The name "opt4" (and variants)
88   OPT5,              ///< The name "opt5" (and variants)
89   OUT_SUBST,         ///< The output substitution item %out%
90   OUTPUT,            ///< The name "output" (and variants)
91   PREPROCESSES,      ///< The name "preprocesses" (and variants)
92   PREPROCESSOR,      ///< The name "preprocessor" (and variants)
93   REQUIRED,          ///< The name "required" (and variants)
94   SEPARATOR,         ///< A configuration item separator
95   SPACE,             ///< Space between options
96   STATS_SUBST,       ///< The stats substitution item %stats%
97   STRING,            ///< A quoted string
98   TARGET_SUBST,      ///< The substitition item %target%
99   TIME_SUBST,        ///< The substitution item %time%
100   TRANSLATES,        ///< The name "translates" (and variants)
101   TRANSLATOR,        ///< The name "translator" (and variants)
102   TRUETOK,           ///< A boolean true value (true/yes/on)
103   VERBOSE_SUBST,     ///< The substitution item %verbose%
104   VERSION_TOK,       ///< The name "version" (and variants)
105   WOPTS_SUBST        ///< The %WOpts% substitution
106 };
107
108 extern ConfigLexerTokens Configlex();
109
110 }
111
112 #endif