Add the VERSION token.
[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
19 namespace llvm {
20
21 struct ConfigLexerInfo
22 {
23   int64_t     IntegerVal;
24   std::string StringVal;
25   bool in_value;
26   unsigned lineNum;
27 };
28
29 extern ConfigLexerInfo ConfigLexerState;
30
31 class InputProvider {
32   public:
33     InputProvider(const std::string& nm) {
34       name = nm;
35       errCount = 0;
36     }
37     virtual ~InputProvider();
38     virtual unsigned read(char *buf, unsigned max_size) = 0;
39     virtual void error(const std::string& msg); 
40     virtual void checkErrors();
41
42   private:
43     std::string name;
44     unsigned errCount;
45 };
46
47 extern InputProvider* ConfigLexerInput;
48
49 enum ConfigLexerTokens {
50   EOFTOK = 0,   ///< Returned by Configlex when we hit end of file
51   EOLTOK,       ///< End of line
52   ERRORTOK,     ///< Error token
53   OPTION,       ///< A command line option
54   SEPARATOR,    ///< A configuration item separator
55   EQUALS,       ///< The equals sign, =
56   TRUETOK,      ///< A boolean true value (true/yes/on)
57   FALSETOK,     ///< A boolean false value (false/no/off)
58   INTEGER,      ///< An integer 
59   STRING,       ///< A quoted string
60   IN_SUBST,     ///< The input substitution item @in@
61   OUT_SUBST,    ///< The output substitution item @out@
62   STATS_SUBST,  ///< The stats substitution item @stats@
63   TIME_SUBST,   ///< The substitution item @time@
64   OPT_SUBST,    ///< The substitution item @opt@
65   TARGET_SUBST, ///< The substitition item @target@
66   LANG,         ///< The item "lang" (and case variants)
67   PREPROCESSOR, ///< The item "preprocessor" (and case variants)
68   TRANSLATOR,   ///< The item "translator" (and case variants)
69   OPTIMIZER,    ///< The item "optimizer" (and case variants)
70   ASSEMBLER,    ///< The item "assembler" (and case variants)
71   LINKER,       ///< The item "linker" (and case variants)
72   NAME,         ///< The item "name" (and case variants)
73   REQUIRED,     ///< The item "required" (and case variants)
74   COMMAND,      ///< The item "command" (and case variants)
75   PREPROCESSES, ///< The item "preprocesses" (and case variants)
76   TRANSLATES,   ///< The item "translates" (and case variants)
77   OPTIMIZES,    ///< The item "optimizes" (and case variants)
78   GROKS_DASH_O, ///< The item "groks_dash_O" (and case variants)
79   OUTPUT_IS_ASM,///< The item "outut_is_asm" (and case variants)
80   OPT1,         ///< The item "opt1" (and case variants)
81   OPT2,         ///< The item "opt2" (and case variants)
82   OPT3,         ///< The item "opt3" (and case variants)
83   OPT4,         ///< The item "opt4" (and case variants)
84   OPT5,         ///< The item "opt5" (and case variants)
85   VERSION,      ///< The item "version" (and case variants)
86 };
87
88 extern ConfigLexerTokens Configlex();
89
90 }
91
92 #endif