blob: bb731d3c6f0551c9491ccee750abb93ded0af004 [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 Spencer52c2dc12004-08-29 19:26:56 +000060 FORCE_SUBST, ///< The substitution item %force%
Reid Spencerbf394882004-08-24 13:59:35 +000061 IN_SUBST, ///< The substitution item %in%
Reid Spencer68fb37a2004-08-14 09:37:15 +000062 INTEGER, ///< An integer
Reid Spencerbf394882004-08-24 13:59:35 +000063 LANG, ///< The name "lang" (and variants)
64 LIBPATHS, ///< The name "libpaths" (and variants)
65 LIBS, ///< The name "libs" (and variants)
66 LINKER, ///< The name "linker" (and variants)
67 NAME, ///< The name "name" (and variants)
68 OPT_SUBST, ///< The substitution item %opt%
69 OPTIMIZER, ///< The name "optimizer" (and variants)
70 OPTION, ///< A command line option
71 OPT1, ///< The name "opt1" (and variants)
72 OPT2, ///< The name "opt2" (and variants)
73 OPT3, ///< The name "opt3" (and variants)
74 OPT4, ///< The name "opt4" (and variants)
75 OPT5, ///< The name "opt5" (and variants)
76 OUT_SUBST, ///< The output substitution item %out%
77 OUTPUT, ///< The name "output" (and variants)
78 PREPROCESSES, ///< The name "preprocesses" (and variants)
79 PREPROCESSOR, ///< The name "preprocessor" (and variants)
80 REQUIRED, ///< The name "required" (and variants)
81 SEPARATOR, ///< A configuration item separator
82 STATS_SUBST, ///< The stats substitution item %stats%
Reid Spencer68fb37a2004-08-14 09:37:15 +000083 STRING, ///< A quoted string
Reid Spencerbf394882004-08-24 13:59:35 +000084 TARGET_SUBST, ///< The substitition item %target%
85 TIME_SUBST, ///< The substitution item %time%
86 TRANSLATES, ///< The name "translates" (and variants)
87 TRANSLATOR, ///< The name "translator" (and variants)
88 TRUETOK, ///< A boolean true value (true/yes/on)
Reid Spencer52c2dc12004-08-29 19:26:56 +000089 VERBOSE_SUBST,///< The substitution item %verbose%
Reid Spencerbf394882004-08-24 13:59:35 +000090 VERSION, ///< The name "version" (and variants)
Reid Spencer68fb37a2004-08-14 09:37:15 +000091};
92
Reid Spencerbf437722004-08-15 08:19:46 +000093extern ConfigLexerTokens Configlex();
94
Reid Spencer68fb37a2004-08-14 09:37:15 +000095}
96
97#endif