blob: 1808ac95f4e0aeb5a90933e2167f3b51c6d809c7 [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;
Reid Spencerbae68252004-08-19 04:49:47 +000025 bool in_value;
26 unsigned lineNum;
Reid Spencer68fb37a2004-08-14 09:37:15 +000027};
28
Reid Spencerbae68252004-08-19 04:49:47 +000029extern ConfigLexerInfo ConfigLexerState;
Reid Spencer68fb37a2004-08-14 09:37:15 +000030
31class 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
47extern InputProvider* ConfigLexerInput;
48
49enum ConfigLexerTokens {
50 EOFTOK = 0, ///< Returned by Configlex when we hit end of file
51 EOLTOK, ///< End of line
52 ERRORTOK, ///< Error token
Reid Spencerbf394882004-08-24 13:59:35 +000053 ARGS_SUBST, ///< THe substitution item %args%
54 ASSEMBLY, ///< The value "assembly" (and variants)
55 ASSEMBLER, ///< The name "assembler" (and variants)
56 BYTECODE, ///< The value "bytecode" (and variants)
57 COMMAND, ///< The name "command" (and variants)
Reid Spencer68fb37a2004-08-14 09:37:15 +000058 EQUALS, ///< The equals sign, =
Reid Spencer68fb37a2004-08-14 09:37:15 +000059 FALSETOK, ///< A boolean false value (false/no/off)
Reid Spencerbf394882004-08-24 13:59:35 +000060 IN_SUBST, ///< The substitution item %in%
Reid Spencer68fb37a2004-08-14 09:37:15 +000061 INTEGER, ///< An integer
Reid Spencerbf394882004-08-24 13:59:35 +000062 LANG, ///< The name "lang" (and variants)
63 LIBPATHS, ///< The name "libpaths" (and variants)
64 LIBS, ///< The name "libs" (and variants)
65 LINKER, ///< The name "linker" (and variants)
66 NAME, ///< The name "name" (and variants)
67 OPT_SUBST, ///< The substitution item %opt%
68 OPTIMIZER, ///< The name "optimizer" (and variants)
69 OPTION, ///< A command line option
70 OPT1, ///< The name "opt1" (and variants)
71 OPT2, ///< The name "opt2" (and variants)
72 OPT3, ///< The name "opt3" (and variants)
73 OPT4, ///< The name "opt4" (and variants)
74 OPT5, ///< The name "opt5" (and variants)
75 OUT_SUBST, ///< The output substitution item %out%
76 OUTPUT, ///< The name "output" (and variants)
77 PREPROCESSES, ///< The name "preprocesses" (and variants)
78 PREPROCESSOR, ///< The name "preprocessor" (and variants)
79 REQUIRED, ///< The name "required" (and variants)
80 SEPARATOR, ///< A configuration item separator
81 STATS_SUBST, ///< The stats substitution item %stats%
Reid Spencer68fb37a2004-08-14 09:37:15 +000082 STRING, ///< A quoted string
Reid Spencerbf394882004-08-24 13:59:35 +000083 TARGET_SUBST, ///< The substitition item %target%
84 TIME_SUBST, ///< The substitution item %time%
85 TRANSLATES, ///< The name "translates" (and variants)
86 TRANSLATOR, ///< The name "translator" (and variants)
87 TRUETOK, ///< A boolean true value (true/yes/on)
88 VERSION, ///< The name "version" (and variants)
Reid Spencer68fb37a2004-08-14 09:37:15 +000089};
90
Reid Spencerbf437722004-08-15 08:19:46 +000091extern ConfigLexerTokens Configlex();
92
Reid Spencer68fb37a2004-08-14 09:37:15 +000093}
94
95#endif