PP: Recognize the '::' token, and translate appropriately to GLSL/HLSL token.

This commit is contained in:
John Kessenich 2017-03-10 18:03:43 -07:00
parent 6212e86faa
commit 523e20dc02
8 changed files with 26 additions and 3 deletions

View File

@ -21,3 +21,8 @@ struct SA { float f[4]; };
out SA outSA;
struct SS { float f; S s; };
out SS outSS;
void foo()
{
SS::f;
}

View File

@ -2,7 +2,8 @@
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:12: 'out' : cannot be bool
ERROR: 0:13: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: outo
ERROR: 2 compilation errors. No code generated.
ERROR: 0:27: '::' : not supported
ERROR: 3 compilation errors. No code generated.
Shader version: 450
@ -20,6 +21,8 @@ ERROR: node is still EOpNull!
0:9 2 (const int)
0:9 Constant:
0:9 4.500000
0:25 Function Definition: foo( (global void)
0:25 Function Parameters:
0:? Linker Objects
0:? 'anon@0' (out block{out 3-element array of float CullDistance gl_CullDistance})
0:? 'outb' (smooth out bool)

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1892"
#define GLSLANG_DATE "09-Mar-2017"
#define GLSLANG_REVISION "Overload400-PrecQual.1897"
#define GLSLANG_DATE "10-Mar-2017"

View File

@ -701,6 +701,10 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
case PpAtomDecrement: return DEC_OP;
case PpAtomIncrement: return INC_OP;
case PpAtomColonColon:
parseContext.error(loc, "not supported", "::", "");
break;
case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT;
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT;
case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT;

View File

@ -120,6 +120,8 @@ const struct {
{ PpAtomDecrement, "--" },
{ PpAtomIncrement, "++" },
{ PpAtomColonColon, "::" },
{ PpAtomDefine, "define" },
{ PpAtomUndef, "undef" },
{ PpAtomIf, "if" },

View File

@ -691,6 +691,12 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
pp->parseContext.ppError(ppToken->loc, "End of line in string", "string", "");
}
return PpAtomConstString;
case ':':
ch = getch();
if (ch == ':')
return PpAtomColonColon;
ungetch();
return ':';
}
ch = getch();

View File

@ -117,6 +117,8 @@ enum EFixedAtoms {
PpAtomDecrement,
PpAtomIncrement,
PpAtomColonColon,
PpAtomPaste,
// Constants

View File

@ -328,6 +328,7 @@ enum EHlslTokenClass {
EHTokDot,
EHTokComma,
EHTokColon,
EHTokColonColon,
EHTokSemicolon,
EHTokBang,
EHTokDash,