llvm/llvm/lib/TableGen/TGLexer.cpp

//===- TGLexer.cpp - Lexer for TableGen -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Implement the Lexer for TableGen.
//
//===----------------------------------------------------------------------===//

#include "TGLexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h" // for strtoull()/strtoll() define
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TableGen/Error.h"
#include <algorithm>
#include <cerrno>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>

usingnamespacellvm;

namespace {
// A list of supported preprocessing directives with their
// internal token kinds and names.
struct PreprocessorDir {};
} // end anonymous namespace

/// Returns true if `C` is a valid character in an identifier. If `First` is
/// true, returns true if `C` is a valid first character of an identifier,
/// else returns true if `C` is a valid non-first character of an identifier.
/// Identifiers match the following regular expression:
///   [a-zA-Z_][0-9a-zA-Z_]*
static bool isValidIDChar(char C, bool First) {}

constexpr PreprocessorDir PreprocessorDirs[] =;

// Returns a pointer past the end of a valid macro name at the start of `Str`.
// Valid macro names match the regular expression [a-zA-Z_][0-9a-zA-Z_]*.
static const char *lexMacroName(StringRef Str) {}

TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) :{}

SMLoc TGLexer::getLoc() const {}

SMRange TGLexer::getLocRange() const {}

/// ReturnError - Set the error to the specified string at the specified
/// location.  This is defined to always return tgtok::Error.
tgtok::TokKind TGLexer::ReturnError(SMLoc Loc, const Twine &Msg) {}

tgtok::TokKind TGLexer::ReturnError(const char *Loc, const Twine &Msg) {}

bool TGLexer::processEOF() {}

int TGLexer::getNextChar() {}

int TGLexer::peekNextChar(int Index) const {}

tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {}

/// LexString - Lex "[^"]*"
tgtok::TokKind TGLexer::LexString() {}

tgtok::TokKind TGLexer::LexVarName() {}

tgtok::TokKind TGLexer::LexIdentifier() {}

/// LexInclude - We just read the "include" token.  Get the string token that
/// comes next and enter the include.
bool TGLexer::LexInclude() {}

/// SkipBCPLComment - Skip over the comment by finding the next CR or LF.
/// Or we may end up at the end of the buffer.
void TGLexer::SkipBCPLComment() {}

/// SkipCComment - This skips C-style /**/ comments.  The only difference from C
/// is that we allow nesting.
bool TGLexer::SkipCComment() {}

/// LexNumber - Lex:
///    [-+]?[0-9]+
///    0x[0-9a-fA-F]+
///    0b[01]+
tgtok::TokKind TGLexer::LexNumber() {}

/// LexBracket - We just read '['.  If this is a code block, return it,
/// otherwise return the bracket.  Match: '[' and '[{ ( [^}]+ | }[^]] )* }]'
tgtok::TokKind TGLexer::LexBracket() {}

/// LexExclaim - Lex '!' and '![a-zA-Z]+'.
tgtok::TokKind TGLexer::LexExclaim() {}

bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {}

tgtok::TokKind TGLexer::prepIsDirective() const {}

bool TGLexer::prepEatPreprocessorDirective(tgtok::TokKind Kind) {}

tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
                                        bool ReturnNextLiveToken) {}

bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) {}

StringRef TGLexer::prepLexMacroName() {}

bool TGLexer::prepSkipLineBegin() {}

bool TGLexer::prepSkipDirectiveEnd() {}

bool TGLexer::prepIsProcessingEnabled() {}

void TGLexer::prepReportPreprocessorStackError() {}