#include "ParseHelper.h"\r
#include "glslang_tab.cpp.h"\r
\r
+int PaReservedWord();\r
+int PaIdentOrType(TString& id, TParseContext&, TSymbol*&);\r
int PaIdentOrReserved(bool reserved, TParseContext&, int line, const char* text, YYSTYPE* pyylval);\r
+int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword);\r
int PaPrecisionKeyword(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);\r
int PaMatNxM(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);\r
int PaDMat(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);\r
%%\r
<*>"//"[^\n]*"\n" { /* ?? carriage and/or line-feed? */ };\r
\r
-"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); }\r
+"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); } // TODO ES 30 reserved\r
"const" { pyylval->lex.line = yylineno; return(CONST); }\r
"uniform" { pyylval->lex.line = yylineno; return(UNIFORM); }\r
-"varying" { pyylval->lex.line = yylineno; return(VARYING); }\r
+"varying" { pyylval->lex.line = yylineno; return(VARYING); } // TODO ES 30 reserved\r
"buffer" { pyylval->lex.line = yylineno; return(BUFFER); }\r
"shared" { pyylval->lex.line = yylineno; return(SHARED); }\r
\r
-"coherent" { pyylval->lex.line = yylineno; return(COHERENT); }\r
-"volatile" { pyylval->lex.line = yylineno; return(VOLATILE); }\r
-"restrict" { pyylval->lex.line = yylineno; return(RESTRICT); }\r
-"readonly" { pyylval->lex.line = yylineno; return(READONLY); }\r
-"writeonly" { pyylval->lex.line = yylineno; return(WRITEONLY); }\r
+"coherent" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, COHERENT); }\r
+"volatile" { if (parseContext.profile == EEsProfile || parseContext.version < 420) \r
+ return PaReservedWord(); \r
+ else\r
+ pyylval->lex.line = yylineno; return(VOLATILE); \r
+ }\r
+"restrict" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, RESTRICT); }\r
+"readonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, READONLY); }\r
+"writeonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, WRITEONLY); }\r
\r
"layout" { pyylval->lex.line = yylineno; return(LAYOUT); }\r
\r
"smooth" { pyylval->lex.line = yylineno; return(SMOOTH); }\r
"noperspective" { pyylval->lex.line = yylineno; return(NOPERSPECTIVE); }\r
\r
-"patch" { pyylval->lex.line = yylineno; return(PATCH); }\r
-"sample" { pyylval->lex.line = yylineno; return(SAMPLE); }\r
+"patch" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, PATCH); }\r
+"sample" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SAMPLE); }\r
\r
"break" { pyylval->lex.line = yylineno; return(BREAK); }\r
"continue" { pyylval->lex.line = yylineno; return(CONTINUE); }\r
"if" { pyylval->lex.line = yylineno; return(IF); }\r
"else" { pyylval->lex.line = yylineno; return(ELSE); }\r
\r
-"subroutine" { pyylval->lex.line = yylineno; return(SUBROUTINE); }\r
+"subroutine" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SUBROUTINE); }\r
\r
"in" { pyylval->lex.line = yylineno; return(IN); }\r
"out" { pyylval->lex.line = yylineno; return(OUT); }\r
"discard" { pyylval->lex.line = yylineno; return(DISCARD); }\r
"return" { pyylval->lex.line = yylineno; return(RETURN); }\r
\r
-"atomic_uint" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ATOMIC_UINT); }\r
+"atomic_uint" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, ATOMIC_UINT); }\r
\r
"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2); }\r
"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3); }\r
"this" { PaReservedWord(); return 0; }\r
"packed" { PaReservedWord(); return 0; }\r
\r
-"resource" { PaReservedWord(); return 0; }\r
+"resource" { if (parseContext.profile == EEsProfile && parseContext.version >= 300 ||\r
+ parseContext.profile != EEsProfile && parseContext.version >= 420) \r
+ return PaReservedWord();\r
+ }\r
\r
"goto" { PaReservedWord(); return 0; }\r
\r
}\r
}\r
\r
-void PaReservedWord()\r
+int PaReservedWord()\r
{\r
GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", "");\r
GlobalParseContext->recover();\r
+\r
+ return 0;\r
}\r
\r
int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbol)\r
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
+ pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
+ pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", yylineno);\r
\r
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);\r
}\r
\r
+int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)\r
+{\r
+ if (pc.profile == EEsProfile && pc.version < 300 ||\r
+ pc.profile != EEsProfile && pc.version < version) {\r
+ pyylval->lex.line = yylineno;\r
+ pyylval->lex.string = NewPoolTString(yytext);\r
+ pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
+ pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", yylineno);\r
+\r
+ return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);\r
+ } else if (pc.profile == EEsProfile && pc.version >= 300)\r
+\r
+ return PaReservedWord();\r
+ else {\r
+ pyylval->lex.line = yylineno;\r
+\r
+ return keyword;\r
+ }\r
+}\r
+\r
int PaPrecisionKeyword(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)\r
{\r
if (pc.profile == EEsProfile || pc.version >= 130)\r
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
- \r
+ pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
+ pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", yylineno);\r
+\r
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);\r
}\r
\r
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
+ pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
+ pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", yylineno);\r
\r
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);\r
}\r
\r
if (pc.profile != EEsProfile && pc.version >= 400)\r
return keyword;\r
- \r
+\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
+ pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
+ pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);\r
\r
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);\r
}\r