HLSL: Member-functions: capture body token stream for deferred syntax/semantics.

This is needed for accessing types/variables within a member function body that are
not known until after the struct is finished being declared. However, that funtionality
is not yet present, this is just the deferred processing, which is working for
static member functions.
This commit is contained in:
John Kessenich 2017-03-11 19:32:47 -07:00
parent 088d52bac2
commit b16f7e6819
5 changed files with 125 additions and 13 deletions

View file

@ -54,6 +54,9 @@ namespace glslang {
bool peekTokenClass(EHlslTokenClass) const;
glslang::TBuiltInVariable mapSemantic(const TString& semantic) { return scanner.mapSemantic(semantic); }
void pushTokenStream(const TVector<HlslToken>* tokens);
void popTokenStream();
protected:
HlslToken token; // the token we are currently looking at, but have not yet accepted
@ -61,7 +64,10 @@ namespace glslang {
HlslTokenStream();
HlslTokenStream& operator=(const HlslTokenStream&);
HlslScanContext& scanner; // lexical scanner, to get next token
HlslScanContext& scanner; // lexical scanner, to get next token from source file
TVector<const TVector<HlslToken>*> tokenStreamStack; // for getting the next token from an existing vector of tokens
TVector<int> tokenPosition;
TVector<HlslToken> currentTokenStack;
// This is the number of tokens we can recedeToken() over.
static const int tokenBufferSize = 2;