blob: fd25589e61b929df08645f67ef524d99fadc94f7 [file] [log] [blame]
Reid Spencer68fb37a2004-08-14 09:37:15 +00001//===- 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
19namespace llvm {
20
21struct ConfigLexerInfo
22{
23 int64_t IntegerVal;
24 std::string StringVal;
25};
26
27extern ConfigLexerInfo ConfigLexerData;
Reid Spencer68fb37a2004-08-14 09:37:15 +000028
29class InputProvider {
30 public:
31 InputProvider(const std::string& nm) {
32 name = nm;
33 errCount = 0;
34 }
35 virtual ~InputProvider();
36 virtual unsigned read(char *buf, unsigned max_size) = 0;
37 virtual void error(const std::string& msg);
38 virtual void checkErrors();
39
40 private:
41 std::string name;
42 unsigned errCount;
43};
44
45extern InputProvider* ConfigLexerInput;
46
47enum ConfigLexerTokens {
48 EOFTOK = 0, ///< Returned by Configlex when we hit end of file
49 EOLTOK, ///< End of line
50 ERRORTOK, ///< Error token
51 OPTION, ///< A command line option
52 SEPARATOR, ///< A configuration item separator
53 EQUALS, ///< The equals sign, =
54 TRUETOK, ///< A boolean true value (true/yes/on)
55 FALSETOK, ///< A boolean false value (false/no/off)
56 INTEGER, ///< An integer
57 STRING, ///< A quoted string
58 IN_SUBST, ///< The input substitution item @in@
59 OUT_SUBST, ///< The output substitution item @out@
60 LANG, ///< The item "lang" (and case variants)
61 PREPROCESSOR, ///< The item "preprocessor" (and case variants)
62 TRANSLATOR, ///< The item "translator" (and case variants)
63 OPTIMIZER, ///< The item "optimizer" (and case variants)
64 ASSEMBLER, ///< The item "assembler" (and case variants)
65 LINKER, ///< The item "linker" (and case variants)
66 NAME, ///< The item "name" (and case variants)
Reid Spencerbf437722004-08-15 08:19:46 +000067 REQUIRED, ///< The item "required" (and case variants)
Reid Spencer68fb37a2004-08-14 09:37:15 +000068 COMMAND, ///< The item "command" (and case variants)
69 PREPROCESSES, ///< The item "preprocesses" (and case variants)
70 GROKS_DASH_O, ///< The item "groks_dash_O" (and case variants)
Reid Spencerbf437722004-08-15 08:19:46 +000071 GROKS_O10N, ///< The item "groks_optimization" (and case variants)
Reid Spencer68fb37a2004-08-14 09:37:15 +000072 OPTIMIZES, ///< The item "optimizes" (and case variants)
Reid Spencerbf437722004-08-15 08:19:46 +000073 OPT1, ///< The item "opt1" (and case variants)
74 OPT2, ///< The item "opt2" (and case variants)
75 OPT3, ///< The item "opt3" (and case variants)
76 OPT4, ///< The item "opt4" (and case variants)
77 OPT5, ///< The item "opt5" (and case variants)
Reid Spencer68fb37a2004-08-14 09:37:15 +000078};
79
Reid Spencerbf437722004-08-15 08:19:46 +000080extern ConfigLexerTokens Configlex();
81
Reid Spencer68fb37a2004-08-14 09:37:15 +000082}
83
84#endif