top | up | prev | next

PP Struct

Definition at line 20 of PP.hpp

Constructors

PP(EvaluationContext& context_)
PP(PP&&) delete
PP(const PP&) delete

Member Functions

std::vector<soulng::lexer::Token>* BeginDefine(const soulng::lexer::Lexeme& id)
void Define(const soulng::lexer::Lexeme& lexeme)
void Elif(const std::vector<soulng::lexer::Token>& exprPPTokens)
void Else()
void Emit(const char32_t* s)
void Emit(const char32_t* s, const soulng::lexer::Lexeme& lexeme, int tokenID)
void Emit(const soulng::lexer::Lexeme& lexeme)
void EndDefine(std::vector<soulng::lexer::Token>& tokens)
void Endif()
bool Evaluate(const std::vector<soulng::lexer::Token>& exprPPTokens) const
void If(const std::vector<soulng::lexer::Token>& exprPPTokens)
void Ifdef(bool defined)
void Ifndef(bool defined)
void Include(bool isAngleHeader, const std::string& headerName)
bool IsDefined(const soulng::lexer::Lexeme& lexeme) const
bool IsKeywordToken(const soulng::lexer::Token& token) const
bool IsProjectHeaderFile(const std::string& headerFilePath) const
PP& operator=(PP&&) delete
PP& operator=(const PP&) delete

Member Variables

EvaluationContext& context
std::u32string ctext
bool elseGroupProcessed
std::stack<bool> elseGroupProcessedStack
int fileIndex
std::string fileName
std::vector<std::unique_ptr<File>> files
std::vector<std::string> headerFilePaths
bool inIfGroup
std::stack<bool> inIfGroupStack
std::vector<std::string> includePath
int line
std::map<soulng::lexer::Lexeme, std::vector<soulng::lexer::Token>> macroMap
bool process
std::stack<bool> processStack
bool processed
std::stack<bool> processedStack
ProjectHeaderFileSet* projectHeaderFileSet
std::string root
bool rootMode
bool save
std::u32string text
std::vector<soulng::lexer::Token>* tokens
bool verbose

Constructor Details

PP Constructor

sngcpp::pp::PP::PP(EvaluationContext& context_)

Definition at line 329 of PP.cpp :
329 :
330 fileIndex(0)save(true)process(true)processed(false)elseGroupProcessed(false)inIfGroup(false)verbose(false)
331 projectHeaderFileSet(nullptr)root(GetCurrentWorkingDirectory())line(1)context(context_)rootMode(false)tokens(nullptr)
332 {
333 }


Declaration at line 22 of PP.hpp


PP Constructor

sngcpp::pp::PP::PP(PP &&) delete

Definition at line 25 of PP.hpp


PP Constructor

sngcpp::pp::PP::PP(const PP &) delete

Definition at line 24 of PP.hpp


Member Function Details

BeginDefine Member Function

std::vector<soulng::lexer::Token>* sngcpp::pp::PP::BeginDefine(const soulng::lexer::Lexeme& id)

Definition at line 339 of PP.cpp :
340 {
341     if (process)
342     {
343         return &macroMap[id];
344     }
345     else
346     {
347         return nullptr;
348     }
349 }


Declaration at line 28 of PP.hpp

Called by: PPLineParser::Define , sngcpp::pp::PP::Define


Define Member Function

void sngcpp::pp::PP::Define(const soulng::lexer::Lexeme& lexeme)

Definition at line 360 of PP.cpp :
361 {
362     std::std::vector<soulng::lexer::Token>*def=BeginDefine(lexeme);
363     EndDefine(*def);
364 }


Declaration at line 30 of PP.hpp

Calls: sngcpp::pp::PP::BeginDefine , sngcpp::pp::PP::EndDefine


Elif Member Function

void sngcpp::pp::PP::Elif(const std::vector<soulng::lexer::Token>& exprPPTokens)

Definition at line 482 of PP.cpp
Declaration at line 39 of PP.hpp

Calls: sngcpp::pp::PP::Evaluate

Called by: PPLineParser::Elif


Else Member Function

void sngcpp::pp::PP::Else()

Definition at line 503 of PP.cpp
Declaration at line 40 of PP.hpp

Called by: PPLineParser::Else


Emit Member Function

void sngcpp::pp::PP::Emit(const char32_t * s)

Definition at line 544 of PP.cpp :
545 {
546     if (save)
547     {
548         while (*s)
549         {
550             text.append(1*s);
551             ++s;
552         }
553     }
554 }


Declaration at line 42 of PP.hpp

Called by: sngcpp::pp::PP::Emit


Emit Member Function

void sngcpp::pp::PP::Emit(const char32_t * s, const soulng::lexer::Lexeme& lexeme, int tokenID)

Definition at line 570 of PP.cpp
Declaration at line 44 of PP.hpp

Calls: sngcpp::pp::PP::Emit

Called by: TextLexer::GetTokenId


Emit Member Function

void sngcpp::pp::PP::Emit(const soulng::lexer::Lexeme& lexeme)

Definition at line 556 of PP.cpp
Declaration at line 43 of PP.hpp

Called by: PPLexer::GetTokenId


EndDefine Member Function

void sngcpp::pp::PP::EndDefine(std::vector<soulng::lexer::Token>& tokens)

Definition at line 351 of PP.cpp :
352 {
353     if (process)
354     {
355         std::vector<soulng::lexer::Token> textTokens = ConvertPPTokensToTextTokens(tokens);
356         std::swap(tokenstextTokens);
357     }
358 }


Declaration at line 29 of PP.hpp

Called by: PPLineParser::Define , sngcpp::pp::PP::Define


Endif Member Function

void sngcpp::pp::PP::Endif()

Definition at line 528 of PP.cpp
Declaration at line 41 of PP.hpp

Called by: PPLineParser::Endif


Evaluate Member Function

bool sngcpp::pp::PP::Evaluate(const std::vector<soulng::lexer::Token>& exprPPTokens) const

Definition at line 426 of PP.cpp
Declaration at line 35 of PP.hpp

Calls: ExpressionParser::Parse

Called by: sngcpp::pp::PP::Elif , sngcpp::pp::PP::If


If Member Function

void sngcpp::pp::PP::If(const std::vector<soulng::lexer::Token>& exprPPTokens)

Definition at line 443 of PP.cpp
Declaration at line 36 of PP.hpp

Calls: sngcpp::pp::PP::Evaluate

Called by: PPLineParser::If


Ifdef Member Function

void sngcpp::pp::PP::Ifdef(bool defined)

Definition at line 456 of PP.cpp
Declaration at line 37 of PP.hpp

Called by: PPLineParser::Ifdef


Ifndef Member Function

void sngcpp::pp::PP::Ifndef(bool defined)

Definition at line 469 of PP.cpp
Declaration at line 38 of PP.hpp

Called by: PPLineParser::Ifndef


Include Member Function

void sngcpp::pp::PP::Include(bool isAngleHeader, const std::string& headerName)

Definition at line 386 of PP.cpp
Declaration at line 34 of PP.hpp

Calls: sngcpp::pp::PP::IsProjectHeaderFile

Called by: PPLineParser::Include


IsDefined Member Function

bool sngcpp::pp::PP::IsDefined(const soulng::lexer::Lexeme& lexeme) const

Definition at line 366 of PP.cpp :
367 {
368     return macroMap.find(lexeme) != macroMap.cend();
369 }


Declaration at line 31 of PP.hpp

Called by: PPLineParser::Ifdef , PPLineParser::Ifndef


IsKeywordToken Member Function

bool sngcpp::pp::PP::IsKeywordToken(const soulng::lexer::Token& token) const

Definition at line 371 of PP.cpp :
372 {
373     soulng::lexer::KeywordMap* keywordMap = CppKeywords::GetKeywordMap();
374     return keywordMap->GetKeywordToken(token.match) != soulng::lexer::INVALID_TOKEN;
375 }


Declaration at line 32 of PP.hpp

Called by: TextLexer::GetTokenId


IsProjectHeaderFile Member Function

bool sngcpp::pp::PP::IsProjectHeaderFile(const std::string& headerFilePath) const

Definition at line 377 of PP.cpp :
378 {
379     if (projectHeaderFileSet)
380     {
381         return projectHeaderFileSet->IsProjectHeaderFile(headerFilePath);
382     }
383     return false;
384 }


Declaration at line 33 of PP.hpp

Calls: sngcpp::pp::ProjectHeaderFileSet::IsProjectHeaderFile

Called by: sngcpp::pp::PP::Include


operator= Member Function

PP & sngcpp::pp::PP::operator=(PP &&) delete

Definition at line 27 of PP.hpp


operator= Member Function

PP & sngcpp::pp::PP::operator=(const PP &) delete

Definition at line 26 of PP.hpp


top | up | prev | next