LLVM 22.0.0git
TGLexer.cpp File Reference
#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"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TableGen/Error.h"
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>

Go to the source code of this file.

Functions

static bool isValidIDChar (char C, bool First)
 Returns true if C is a valid character in an identifier.
static const charlexMacroName (StringRef Str)

Variables

constexpr PreprocessorDir PreprocessorDirs []

Function Documentation

◆ isValidIDChar()

bool isValidIDChar ( char C,
bool First )
static

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_]*

Definition at line 44 of file TGLexer.cpp.

References llvm::CallingConv::C, llvm::First, llvm::isAlpha(), and llvm::isDigit().

Referenced by lexMacroName().

◆ lexMacroName()

const char * lexMacroName ( StringRef Str)
static

Definition at line 58 of file TGLexer.cpp.

References assert(), isValidIDChar(), and llvm::Next.

Referenced by llvm::TGLexer::TGLexer().

Variable Documentation

◆ PreprocessorDirs

PreprocessorDir PreprocessorDirs[]
constexpr
Initial value:
= {{tgtok::Ifdef, "ifdef"},
{tgtok::Ifndef, "ifndef"},
{tgtok::Else, "else"},
{tgtok::Endif, "endif"},
{tgtok::Define, "define"}}

Definition at line 50 of file TGLexer.cpp.