Preprocessor: Rationalize, simplify, and correct the stack of input sources and their tokenization. This included
- consistently dealing with EOF and its effect on error recovery (bug 11444, #1) - turning a simulated OO hierarchy of function pointers and typecasting into a real C++ class hierarchy - correctly handling '\' everywhere, in all classes of tokens, as a layer before preprocessing itself - conditionally handling '\n' in macro expansion input, depending on whether it is in a macro expression or not - delete some unused "memory cleanup" code git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24626 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
08d182470b
commit
fcb4ed054c
16 changed files with 750 additions and 479 deletions
|
|
@ -84,7 +84,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace glslang {
|
||||
|
||||
TPpContext::TPpContext(TParseContext& pc) :
|
||||
preamble(0), strings(0), parseContext(pc)
|
||||
preamble(0), strings(0), parseContext(pc), inComment(false)
|
||||
{
|
||||
InitAtomTable();
|
||||
InitScanner(this);
|
||||
|
|
@ -143,17 +143,18 @@ TPpContext::~TPpContext()
|
|||
delete it->second->mac.body;
|
||||
mem_FreePool(pool);
|
||||
delete [] preamble;
|
||||
|
||||
// free up the inputStack
|
||||
while (! inputStack.empty())
|
||||
popInput();
|
||||
}
|
||||
|
||||
void TPpContext::setInput(TInputScanner& input, bool versionWillBeError)
|
||||
{
|
||||
StringInputSrc* in = new StringInputSrc;
|
||||
in->input = &input;
|
||||
in->scan = sourceScan;
|
||||
in->getch = (int (*)(TPpContext*, InputSrc *, TPpToken *))sourceGetCh;
|
||||
in->ungetch = (void (*)(TPpContext*, InputSrc *, int, TPpToken *))sourceUngetCh;
|
||||
in->prev = currentInput;
|
||||
currentInput = in;
|
||||
assert(inputStack.size() == 0);
|
||||
|
||||
pushInput(new tStringInput(this, input));
|
||||
|
||||
errorOnVersion = versionWillBeError;
|
||||
versionSeen = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue