blob: 7a9693d5b53e93bc5ae2fde3061deb1c34973410 [file] [log] [blame]
Reid Spencer9d68ff62004-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 Spencerdc203892004-08-19 04:49:47 +000025 bool in_value;
26 unsigned lineNum;
Reid Spencer9d68ff62004-08-14 09:37:15 +000027};
28
Reid Spencerdc203892004-08-19 04:49:47 +000029extern ConfigLexerInfo ConfigLexerState;
Reid Spencer9d68ff62004-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 Spencered9b3c42004-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 Spencera6818452004-08-30 06:29:06 +000058 DEFS_SUBST, ///< The substitution item %defs%
Reid Spencer9d68ff62004-08-14 09:37:15 +000059 EQUALS, ///< The equals sign, =
Reid Spencer9d68ff62004-08-14 09:37:15 +000060 FALSETOK, ///< A boolean false value (false/no/off)
Reid Spencer1b5b24f2004-08-29 19:26:56 +000061 FORCE_SUBST, ///< The substitution item %force%
Reid Spencered9b3c42004-08-24 13:59:35 +000062 IN_SUBST, ///< The substitution item %in%
Reid Spencera6818452004-08-30 06:29:06 +000063 INCLS_SUBST, ///< The substitution item %incls%
Reid Spencer9d68ff62004-08-14 09:37:15 +000064 INTEGER, ///< An integer
Reid Spencered9b3c42004-08-24 13:59:35 +000065 LANG, ///< The name "lang" (and variants)
66 LIBPATHS, ///< The name "libpaths" (and variants)
67 LIBS, ///< The name "libs" (and variants)
Reid Spencera6818452004-08-30 06:29:06 +000068 LIBS_SUBST, ///< The substitution item %libs%
Reid Spencered9b3c42004-08-24 13:59:35 +000069 LINKER, ///< The name "linker" (and variants)
70 NAME, ///< The name "name" (and variants)
71 OPT_SUBST, ///< The substitution item %opt%
72 OPTIMIZER, ///< The name "optimizer" (and variants)
73 OPTION, ///< A command line option
74 OPT1, ///< The name "opt1" (and variants)
75 OPT2, ///< The name "opt2" (and variants)
76 OPT3, ///< The name "opt3" (and variants)
77 OPT4, ///< The name "opt4" (and variants)
78 OPT5, ///< The name "opt5" (and variants)
79 OUT_SUBST, ///< The output substitution item %out%
80 OUTPUT, ///< The name "output" (and variants)
81 PREPROCESSES, ///< The name "preprocesses" (and variants)
82 PREPROCESSOR, ///< The name "preprocessor" (and variants)
83 REQUIRED, ///< The name "required" (and variants)
84 SEPARATOR, ///< A configuration item separator
85 STATS_SUBST, ///< The stats substitution item %stats%
Reid Spencer9d68ff62004-08-14 09:37:15 +000086 STRING, ///< A quoted string
Reid Spencered9b3c42004-08-24 13:59:35 +000087 TARGET_SUBST, ///< The substitition item %target%
88 TIME_SUBST, ///< The substitution item %time%
89 TRANSLATES, ///< The name "translates" (and variants)
90 TRANSLATOR, ///< The name "translator" (and variants)
91 TRUETOK, ///< A boolean true value (true/yes/on)
Reid Spencer1b5b24f2004-08-29 19:26:56 +000092 VERBOSE_SUBST,///< The substitution item %verbose%
Reid Spencered9b3c42004-08-24 13:59:35 +000093 VERSION, ///< The name "version" (and variants)
Reid Spencer9d68ff62004-08-14 09:37:15 +000094};
95
Reid Spencerf58e8d32004-08-15 08:19:46 +000096extern ConfigLexerTokens Configlex();
97
Reid Spencer9d68ff62004-08-14 09:37:15 +000098}
99
100#endif