Hash :
3a01d1bc
Author :
Date :
2011-08-30T05:10:53
Preparation for macro expansion. Review URL: http://codereview.appspot.com/4919045 git-svn-id: https://angleproject.googlecode.com/svn/trunk@741 736b8ea6-26fd-11df-bfd4-992fa37f6226
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//
// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "Preprocessor.h"
#include <algorithm>
#include "compiler/debug.h"
#include "Context.h"
#include "stl_utils.h"
namespace pp
{
Preprocessor::Preprocessor() : mContext(NULL)
{
}
Preprocessor::~Preprocessor()
{
delete mContext;
}
bool Preprocessor::init()
{
mContext = new Context;
return mContext->init();
}
bool Preprocessor::process(int count,
const char* const string[],
const int length[])
{
ASSERT((count >=0) && (string != NULL));
if ((count < 0) || (string == NULL))
return false;
reset();
return mContext->process(count, string, length, &mTokens);
}
void Preprocessor::reset()
{
std::for_each(mTokens.begin(), mTokens.end(), Delete());
mTokens.clear();
}
} // namespace pp