Merge pull request #16 from google/pp-directive

Preprocessing directive handling
This commit is contained in:
John Kessenich 2015-07-14 19:36:29 -06:00
commit 279012d8c4
9 changed files with 87 additions and 48 deletions

View file

@ -217,9 +217,11 @@ public:
void setCurrentString(int string) { currentScanner->setString(string); }
void setScanner(TInputScanner* scanner) { currentScanner = scanner; }
bool lineDirectiveShouldSetNextLine() const;
void notifyVersion(int line, int version, const char* type_string);
void notifyErrorDirective(int line, const char* error_message);
void notifyLineDirective(int line, bool has_source, int source);
void notifyLineDirective(int curLineNo, int newLineNo, bool hasSource, int sourceNum);
// The following are implemented in Versions.cpp to localize version/profile/stage/extensions control
void initializeExtensionBehavior();
@ -240,7 +242,7 @@ public:
void setVersionCallback(const std::function<void(int, int, const char*)>& func) { versionCallback = func; }
void setPragmaCallback(const std::function<void(int, const TVector<TString>&)>& func) { pragmaCallback = func; }
void setLineCallback(const std::function<void(int, bool, int)>& func) { lineCallback = func; }
void setLineCallback(const std::function<void(int, int, bool, int)>& func) { lineCallback = func; }
void setExtensionCallback(const std::function<void(int, const char*, const char*)>& func) { extensionCallback = func; }
void setErrorCallback(const std::function<void(int, const char*)>& func) { errorCallback = func; }
@ -354,7 +356,7 @@ protected:
// These, if set, will be called when a line, pragma ... is preprocessed.
// They will be called with any parameters to the original directive.
std::function<void(int, bool, int)> lineCallback;
std::function<void(int, int, bool, int)> lineCallback;
std::function<void(int, const TVector<TString>&)> pragmaCallback;
std::function<void(int, int, const char*)> versionCallback;
std::function<void(int, const char*, const char*)> extensionCallback;