clang API Documentation
#include <TokenLexer.h>
Public Member Functions | |
| TokenLexer (Token &Tok, SourceLocation ILEnd, MacroArgs *ActualArgs, Preprocessor &pp) | |
| void | Init (Token &Tok, SourceLocation ILEnd, MacroArgs *ActualArgs) |
| TokenLexer (const Token *TokArray, unsigned NumToks, bool DisableExpansion, bool ownsTokens, Preprocessor &pp) | |
| void | Init (const Token *TokArray, unsigned NumToks, bool DisableMacroExpansion, bool OwnsTokens) |
| ~TokenLexer () | |
| unsigned | isNextTokenLParen () const |
| void | Lex (Token &Tok) |
| Lex - Lex and return a token from this macro stream. | |
| bool | isParsingPreprocessorDirective () const |
Friends | |
| class | Preprocessor |
TokenLexer - This implements a lexer that returns token from a macro body or token stream instead of lexing from a character buffer. This is used for macro expansion and _Pragma handling, for example.
Definition at line 29 of file TokenLexer.h.
| clang::TokenLexer::TokenLexer | ( | Token & | Tok, |
| SourceLocation | ILEnd, | ||
| MacroArgs * | ActualArgs, | ||
| Preprocessor & | pp | ||
| ) | [inline] |
Create a TokenLexer for the specified macro with the specified actual arguments. Note that this ctor takes ownership of the ActualArgs pointer. ILEnd specifies the location of the ')' for a function-like macro or the identifier for an object-like macro.
Definition at line 101 of file TokenLexer.h.
References Init().
| clang::TokenLexer::TokenLexer | ( | const Token * | TokArray, |
| unsigned | NumToks, | ||
| bool | DisableExpansion, | ||
| bool | ownsTokens, | ||
| Preprocessor & | pp | ||
| ) | [inline] |
Create a TokenLexer for the specified token stream. If 'OwnsTokens' is specified, this takes ownership of the tokens and delete[]'s them when the token lexer is empty.
Definition at line 116 of file TokenLexer.h.
References Init().
| clang::TokenLexer::~TokenLexer | ( | ) | [inline] |
Definition at line 130 of file TokenLexer.h.
| void TokenLexer::Init | ( | Token & | Tok, |
| SourceLocation | ELEnd, | ||
| MacroArgs * | Actuals | ||
| ) |
Init - Initialize this TokenLexer to expand from the specified macro with the specified argument information. Note that this ctor takes ownership of the ActualArgs pointer. ILEnd specifies the location of the ')' for a function-like macro or the identifier for an object-like macro.
Create a TokenLexer for the specified macro with the specified actual arguments. Note that this ctor takes ownership of the ActualArgs pointer.
Definition at line 26 of file TokenLexer.cpp.
References clang::SourceManager::createExpansionLoc(), clang::MacroInfo::DisableMacro(), clang::MacroInfo::getDefinitionLength(), clang::SourceManager::getExpansionLoc(), clang::Token::getIdentifierInfo(), clang::Token::getLocation(), clang::Preprocessor::getMacroInfo(), clang::SourceManager::getNextLocalOffset(), clang::MacroInfo::getNumArgs(), clang::Preprocessor::getSourceManager(), clang::Token::hasLeadingSpace(), clang::Token::isAtStartOfLine(), clang::MacroInfo::isFunctionLike(), clang::SourceLocation::isValid(), clang::MacroInfo::tokens_begin(), and clang::MacroInfo::tokens_end().
Referenced by TokenLexer().
| void TokenLexer::Init | ( | const Token * | TokArray, |
| unsigned | NumToks, | ||
| bool | disableMacroExpansion, | ||
| bool | ownsTokens | ||
| ) |
Init - Initialize this TokenLexer with the specified token stream. This does not take ownership of the specified token vector.
DisableExpansion is true when macro expansion of tokens lexed from this stream should be disabled.
Create a TokenLexer for the specified token stream. This does not take ownership of the specified token vector.
Definition at line 81 of file TokenLexer.cpp.
References clang::Token::hasLeadingSpace(), and clang::Token::isAtStartOfLine().
| unsigned TokenLexer::isNextTokenLParen | ( | ) | const |
isNextTokenLParen - If the next token lexed will pop this macro off the expansion stack, return 2. If the next unexpanded token is a '(', return 1, otherwise return 0.
Definition at line 619 of file TokenLexer.cpp.
References clang::Token::is().
| bool TokenLexer::isParsingPreprocessorDirective | ( | ) | const |
isParsingPreprocessorDirective - Return true if we are in the middle of a preprocessor directive.
Definition at line 628 of file TokenLexer.cpp.
References clang::Token::is().
| void TokenLexer::Lex | ( | Token & | Tok | ) |
Lex - Lex and return a token from this macro stream.
Definition at line 359 of file TokenLexer.cpp.
References clang::SourceManager::createExpansionLoc(), clang::MacroInfo::EnableMacro(), clang::Token::getIdentifierInfo(), clang::Token::getLength(), clang::Token::getLocation(), clang::Preprocessor::getSourceManager(), clang::IdentifierInfo::getTokenID(), clang::Preprocessor::HandleEndOfTokenLexer(), clang::Preprocessor::HandleIdentifier(), clang::Preprocessor::HandlePoisonedIdentifier(), clang::Token::is(), clang::Token::isAnnotation(), clang::SourceManager::isBeforeInSLocAddrSpace(), clang::IdentifierInfo::isHandleIdentifierCase(), clang::IdentifierInfo::isPoisoned(), clang::SourceLocation::isValid(), clang::Token::LeadingSpace, clang::Preprocessor::Lex(), clang::Token::setFlagValue(), clang::Token::setKind(), clang::Token::setLocation(), and clang::Token::StartOfLine.
friend class Preprocessor [friend] |
Definition at line 52 of file TokenLexer.h.