2015-05-07 18:10:22 -07:00
|
|
|
#include <iostream>
|
|
|
|
|
#include "CLexer.hpp"
|
|
|
|
|
#include "CPreprocessor.hpp"
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
|
|
void printTokenList(CLexer::TokenList& out)
|
|
|
|
|
{
|
|
|
|
|
for (const CLexer::Token& token : out)
|
|
|
|
|
std::cout << token.value;
|
|
|
|
|
std::cout << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-07 19:20:06 -07:00
|
|
|
|
|
|
|
|
void linkInstancePreprocessor(CLexer::TokenList& tokens, CPreprocessor::DefineTable& defineTable)
|
|
|
|
|
{
|
|
|
|
|
(void)(defineTable);
|
|
|
|
|
CPreprocessor::advanceList(tokens);
|
|
|
|
|
if (tokens.size() == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
std::cout << tokens.begin()->value << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-07 18:10:22 -07:00
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
CPreprocessor preprocessor;
|
2015-05-07 19:20:06 -07:00
|
|
|
preprocessor.registerHook("link_instance", linkInstancePreprocessor);
|
2015-05-07 18:10:22 -07:00
|
|
|
preprocessor.preprocessFile("main.as");
|
|
|
|
|
std::cout << preprocessor.finalizedSource() << std::endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|