blob: 5a3e9e9f74f44132e2ce787e698895efd458c9ce [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;
28extern unsigned ConfigLexerLine;
29
30class InputProvider {
31 public:
32 InputProvider(const std::string& nm) {
33 name = nm;
34 errCount = 0;
35 }
36 virtual ~InputProvider();
37 virtual unsigned read(char *buf, unsigned max_size) = 0;
38 virtual void error(const std::string& msg);
39 virtual void checkErrors();
40
41 private:
42 std::string name;
43 unsigned errCount;
44};
45
46extern InputProvider* ConfigLexerInput;
47
48enum ConfigLexerTokens {
49 EOFTOK = 0, ///< Returned by Configlex when we hit end of file
50 EOLTOK, ///< End of line
51 ERRORTOK, ///< Error token
52 OPTION, ///< A command line option
53 SEPARATOR, ///< A configuration item separator
54 EQUALS, ///< The equals sign, =
55 TRUETOK, ///< A boolean true value (true/yes/on)
56 FALSETOK, ///< A boolean false value (false/no/off)
57 INTEGER, ///< An integer
58 STRING, ///< A quoted string
59 IN_SUBST, ///< The input substitution item @in@
60 OUT_SUBST, ///< The output substitution item @out@
61 LANG, ///< The item "lang" (and case variants)
62 PREPROCESSOR, ///< The item "preprocessor" (and case variants)
63 TRANSLATOR, ///< The item "translator" (and case variants)
64 OPTIMIZER, ///< The item "optimizer" (and case variants)
65 ASSEMBLER, ///< The item "assembler" (and case variants)
66 LINKER, ///< The item "linker" (and case variants)
67 NAME, ///< The item "name" (and case variants)
68 NEEDED, ///< The item "needed" (and case variants)
69 COMMAND, ///< The item "command" (and case variants)
70 PREPROCESSES, ///< The item "preprocesses" (and case variants)
71 GROKS_DASH_O, ///< The item "groks_dash_O" (and case variants)
72 OPTIMIZES, ///< The item "optimizes" (and case variants)
73};
74
75}
76
77#endif