2004-08-14 11:37:15 +02:00
|
|
|
//===- ConfigLexer.h - ConfigLexer Declarations -----------------*- C++ -*-===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2004-08-14 11:37:15 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2005-04-22 02:00:37 +02:00
|
|
|
// This file was developed by Reid Spencer and is distributed under the
|
2004-08-14 11:37:15 +02:00
|
|
|
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2004-08-14 11:37:15 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the types and data needed by ConfigLexer.l
|
|
|
|
//
|
|
|
|
//===------------------------------------------------------------------------===
|
|
|
|
#ifndef LLVM_TOOLS_LLVMC_CONFIGLEXER_H
|
|
|
|
#define LLVM_TOOLS_LLVMC_CONFIGLEXER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <istream>
|
2004-09-01 22:36:15 +02:00
|
|
|
#include <cassert>
|
2004-08-14 11:37:15 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
struct ConfigLexerInfo
|
|
|
|
{
|
|
|
|
int64_t IntegerVal;
|
|
|
|
std::string StringVal;
|
2004-08-19 06:49:47 +02:00
|
|
|
bool in_value;
|
|
|
|
unsigned lineNum;
|
2004-08-14 11:37:15 +02:00
|
|
|
};
|
|
|
|
|
2004-08-19 06:49:47 +02:00
|
|
|
extern ConfigLexerInfo ConfigLexerState;
|
2004-08-14 11:37:15 +02:00
|
|
|
|
|
|
|
class InputProvider {
|
|
|
|
public:
|
|
|
|
InputProvider(const std::string& nm) {
|
|
|
|
name = nm;
|
|
|
|
errCount = 0;
|
|
|
|
}
|
|
|
|
virtual ~InputProvider();
|
|
|
|
virtual unsigned read(char *buf, unsigned max_size) = 0;
|
2005-04-22 02:00:37 +02:00
|
|
|
virtual void error(const std::string& msg);
|
2004-08-14 11:37:15 +02:00
|
|
|
virtual void checkErrors();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string name;
|
|
|
|
unsigned errCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern InputProvider* ConfigLexerInput;
|
|
|
|
|
|
|
|
enum ConfigLexerTokens {
|
|
|
|
EOFTOK = 0, ///< Returned by Configlex when we hit end of file
|
|
|
|
EOLTOK, ///< End of line
|
|
|
|
ERRORTOK, ///< Error token
|
2004-08-24 15:59:35 +02:00
|
|
|
ARGS_SUBST, ///< THe substitution item %args%
|
|
|
|
ASSEMBLY, ///< The value "assembly" (and variants)
|
|
|
|
ASSEMBLER, ///< The name "assembler" (and variants)
|
|
|
|
BYTECODE, ///< The value "bytecode" (and variants)
|
|
|
|
COMMAND, ///< The name "command" (and variants)
|
2004-08-30 08:29:06 +02:00
|
|
|
DEFS_SUBST, ///< The substitution item %defs%
|
2004-08-14 11:37:15 +02:00
|
|
|
EQUALS, ///< The equals sign, =
|
|
|
|
FALSETOK, ///< A boolean false value (false/no/off)
|
2004-09-14 03:59:31 +02:00
|
|
|
FOPTS_SUBST, ///< The substitution item %fOpts%
|
2004-08-24 15:59:35 +02:00
|
|
|
IN_SUBST, ///< The substitution item %in%
|
2004-08-30 08:29:06 +02:00
|
|
|
INCLS_SUBST, ///< The substitution item %incls%
|
2005-04-22 02:00:37 +02:00
|
|
|
INTEGER, ///< An integer
|
2004-08-24 15:59:35 +02:00
|
|
|
LANG, ///< The name "lang" (and variants)
|
|
|
|
LIBPATHS, ///< The name "libpaths" (and variants)
|
|
|
|
LIBS, ///< The name "libs" (and variants)
|
2004-08-30 08:29:06 +02:00
|
|
|
LIBS_SUBST, ///< The substitution item %libs%
|
2004-08-24 15:59:35 +02:00
|
|
|
LINKER, ///< The name "linker" (and variants)
|
2004-09-14 03:59:31 +02:00
|
|
|
MOPTS_SUBST, ///< The substitution item %Mopts%
|
2004-08-24 15:59:35 +02:00
|
|
|
NAME, ///< The name "name" (and variants)
|
|
|
|
OPT_SUBST, ///< The substitution item %opt%
|
|
|
|
OPTIMIZER, ///< The name "optimizer" (and variants)
|
|
|
|
OPTION, ///< A command line option
|
|
|
|
OPT1, ///< The name "opt1" (and variants)
|
|
|
|
OPT2, ///< The name "opt2" (and variants)
|
|
|
|
OPT3, ///< The name "opt3" (and variants)
|
|
|
|
OPT4, ///< The name "opt4" (and variants)
|
|
|
|
OPT5, ///< The name "opt5" (and variants)
|
|
|
|
OUT_SUBST, ///< The output substitution item %out%
|
|
|
|
OUTPUT, ///< The name "output" (and variants)
|
|
|
|
PREPROCESSES, ///< The name "preprocesses" (and variants)
|
|
|
|
PREPROCESSOR, ///< The name "preprocessor" (and variants)
|
|
|
|
REQUIRED, ///< The name "required" (and variants)
|
|
|
|
SEPARATOR, ///< A configuration item separator
|
2004-11-24 00:35:50 +01:00
|
|
|
SPACE, ///< Space between options
|
2004-08-24 15:59:35 +02:00
|
|
|
STATS_SUBST, ///< The stats substitution item %stats%
|
2004-08-14 11:37:15 +02:00
|
|
|
STRING, ///< A quoted string
|
2004-08-24 15:59:35 +02:00
|
|
|
TARGET_SUBST, ///< The substitition item %target%
|
|
|
|
TIME_SUBST, ///< The substitution item %time%
|
|
|
|
TRANSLATES, ///< The name "translates" (and variants)
|
|
|
|
TRANSLATOR, ///< The name "translator" (and variants)
|
|
|
|
TRUETOK, ///< A boolean true value (true/yes/on)
|
2004-08-29 21:26:56 +02:00
|
|
|
VERBOSE_SUBST,///< The substitution item %verbose%
|
2004-10-28 06:06:15 +02:00
|
|
|
VERSION_TOK, ///< The name "version" (and variants)
|
2004-09-14 03:59:31 +02:00
|
|
|
WOPTS_SUBST, ///< The %WOpts% substitution
|
2004-08-14 11:37:15 +02:00
|
|
|
};
|
|
|
|
|
2004-08-15 10:19:46 +02:00
|
|
|
extern ConfigLexerTokens Configlex();
|
|
|
|
|
2004-08-14 11:37:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|