Add ability to treat keywords as identifiers in versions that had not yet reserved the keyword.
Used this for precision keywords and double matrix keywords. Also added a few missing reserved words. Also removed redundant "syntax error" when there is a parse error. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20423 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
59ddbafb62
commit
1c809955ba
@ -1,10 +1,10 @@
|
|||||||
#version 120
|
#version 120
|
||||||
|
|
||||||
lowp vec3 a;
|
float lowp;
|
||||||
mediump float b;
|
float mediump;
|
||||||
highp int c;
|
float highp;
|
||||||
|
|
||||||
precision highp float;
|
float precision;
|
||||||
|
|
||||||
in vec4 i;
|
in vec4 i;
|
||||||
out vec4 o;
|
out vec4 o;
|
||||||
|
@ -6,11 +6,11 @@ int a = 0xffffffff; // 32 bits, a gets the value -1
|
|||||||
//int b = 0xffffffffU; // ERROR: can't convert uint to int
|
//int b = 0xffffffffU; // ERROR: can't convert uint to int
|
||||||
uint c = 0xffffffff; // 32 bits, c gets the value 0xFFFFFFFF
|
uint c = 0xffffffff; // 32 bits, c gets the value 0xFFFFFFFF
|
||||||
//uint d = 0xffffffffU; // 32 bits, d gets the value 0xFFFFFFFF
|
//uint d = 0xffffffffU; // 32 bits, d gets the value 0xFFFFFFFF
|
||||||
int e = -1; // the literal is “1”, then negation is performed,
|
int e = -1; // the literal is "1", then negation is performed,
|
||||||
// and the resulting non-literal 32-bit signed
|
// and the resulting non-literal 32-bit signed
|
||||||
// bit pattern of 0xFFFFFFFF is assigned, giving e
|
// bit pattern of 0xFFFFFFFF is assigned, giving e
|
||||||
// the value of -1.
|
// the value of -1.
|
||||||
//uint f = -1u; // the literal is “1u”, then negation is performed,
|
//uint f = -1u; // the literal is "1u", then negation is performed,
|
||||||
// and the resulting non-literal 32-bit unsigned
|
// and the resulting non-literal 32-bit unsigned
|
||||||
// bit pattern of 0xFFFFFFFF is assigned, giving f
|
// bit pattern of 0xFFFFFFFF is assigned, giving f
|
||||||
// the value of 0xFFFFFFFF.
|
// the value of 0xFFFFFFFF.
|
||||||
@ -58,20 +58,20 @@ light lights[];
|
|||||||
const int numLights = 2;
|
const int numLights = 2;
|
||||||
light lights[numLights];
|
light lights[numLights];
|
||||||
|
|
||||||
in vec3 normal;
|
in vec3 normal;
|
||||||
centroid in vec2 TexCoord;
|
centroid in vec2 TexCoord;
|
||||||
invariant centroid in vec4 Color;
|
invariant centroid in vec4 Color;
|
||||||
noperspective in float temperature;
|
noperspective in float temperature;
|
||||||
flat in vec3 myColor;
|
flat in vec3 myColor;
|
||||||
noperspective centroid in vec2 myTexCoord;
|
noperspective centroid in vec2 myTexCoord;
|
||||||
|
|
||||||
uniform vec4 lightPosition;
|
uniform vec4 lightPosition;
|
||||||
uniform vec3 color = vec3(0.7, 0.7, 0.2); // value assigned at link time
|
uniform vec3 color = vec3(0.7, 0.7, 0.2); // value assigned at link time
|
||||||
|
|
||||||
in Material {
|
in Material {
|
||||||
smooth in vec4 Color1; // legal, input inside in block
|
smooth in vec4 Color1; // legal, input inside in block
|
||||||
smooth vec4 Color2; // legal, 'in' inherited from 'in Material'
|
smooth vec4 Color2; // legal, 'in' inherited from 'in Material'
|
||||||
vec2 TexCoord; // legal, TexCoord is an input
|
vec2 TexCoord; // legal, TexCoord is an input
|
||||||
uniform float Atten; // illegal, mismatched storage qualifier
|
uniform float Atten; // illegal, mismatched storage qualifier
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -80,8 +80,8 @@ in Light {
|
|||||||
vec4 LightPos;
|
vec4 LightPos;
|
||||||
vec3 LightColor;
|
vec3 LightColor;
|
||||||
};
|
};
|
||||||
in ColoredTexture {
|
in ColoredTexture {
|
||||||
vec4 Color;
|
vec4 Color;
|
||||||
vec2 TexCoord;
|
vec2 TexCoord;
|
||||||
} Material; // instance name
|
} Material; // instance name
|
||||||
vec3 Color; // different Color than Material.Color
|
vec3 Color; // different Color than Material.Color
|
||||||
@ -104,8 +104,8 @@ layout(location = 3, index = 1) out vec4 factor;
|
|||||||
layout(location = 2) out vec4 colors[3];
|
layout(location = 2) out vec4 colors[3];
|
||||||
|
|
||||||
layout (depth_greater) out float gl_FragDepth;
|
layout (depth_greater) out float gl_FragDepth;
|
||||||
|
|
||||||
// redeclaration that changes nothing is allowed
|
// redeclaration that changes nothing is allowed
|
||||||
out float gl_FragDepth;
|
out float gl_FragDepth;
|
||||||
|
|
||||||
// assume it may be modified in any way
|
// assume it may be modified in any way
|
||||||
@ -120,7 +120,7 @@ layout (depth_less) out float gl_FragDepth;
|
|||||||
// assume it will not be modified
|
// assume it will not be modified
|
||||||
layout (depth_unchanged) out float gl_FragDepth;
|
layout (depth_unchanged) out float gl_FragDepth;
|
||||||
|
|
||||||
in vec4 gl_Color; // predeclared by the fragment language
|
in vec4 gl_Color; // predeclared by the fragment language
|
||||||
flat in vec4 gl_Color; // redeclared by user to be flat
|
flat in vec4 gl_Color; // redeclared by user to be flat
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,11 @@ LF [lL][fF]
|
|||||||
#include "ParseHelper.h"
|
#include "ParseHelper.h"
|
||||||
#include "glslang_tab.cpp.h"
|
#include "glslang_tab.cpp.h"
|
||||||
|
|
||||||
|
int PaIdentOrReserved(bool reserved, TParseContext&, int line, char* text, YYSTYPE* pyylval);
|
||||||
|
int PaPrecisionKeyword(TParseContext&, int line, char* text, YYSTYPE* pyylval, int keyword);
|
||||||
|
int PaMatNxM(TParseContext&, int line, char* text, YYSTYPE* pyylval, int keyword);
|
||||||
|
int PaDMat(TParseContext&, int line, char* text, YYSTYPE* pyylval, int keyword);
|
||||||
|
|
||||||
/* windows only pragma */
|
/* windows only pragma */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4102)
|
#pragma warning(disable : 4102)
|
||||||
@ -101,19 +106,27 @@ TSourceLoc yylineno;
|
|||||||
|
|
||||||
"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); }
|
"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); }
|
||||||
"const" { pyylval->lex.line = yylineno; return(CONST); }
|
"const" { pyylval->lex.line = yylineno; return(CONST); }
|
||||||
"patch" { pyylval->lex.line = yylineno; return(PATCH); }
|
|
||||||
"sample" { pyylval->lex.line = yylineno; return(SAMPLE); }
|
|
||||||
"uniform" { pyylval->lex.line = yylineno; return(UNIFORM); }
|
"uniform" { pyylval->lex.line = yylineno; return(UNIFORM); }
|
||||||
|
"varying" { pyylval->lex.line = yylineno; return(VARYING); }
|
||||||
"buffer" { pyylval->lex.line = yylineno; return(BUFFER); }
|
"buffer" { pyylval->lex.line = yylineno; return(BUFFER); }
|
||||||
"shared" { pyylval->lex.line = yylineno; return(SHARED); }
|
"shared" { pyylval->lex.line = yylineno; return(SHARED); }
|
||||||
|
|
||||||
"coherent" { pyylval->lex.line = yylineno; return(COHERENT); }
|
"coherent" { pyylval->lex.line = yylineno; return(COHERENT); }
|
||||||
"volatile" { pyylval->lex.line = yylineno; return(VOLATILE); }
|
"volatile" { pyylval->lex.line = yylineno; return(VOLATILE); }
|
||||||
"restrict" { pyylval->lex.line = yylineno; return(RESTRICT); }
|
"restrict" { pyylval->lex.line = yylineno; return(RESTRICT); }
|
||||||
"readonly" { pyylval->lex.line = yylineno; return(READONLY); }
|
"readonly" { pyylval->lex.line = yylineno; return(READONLY); }
|
||||||
"writeonly" { pyylval->lex.line = yylineno; return(WRITEONLY); }
|
"writeonly" { pyylval->lex.line = yylineno; return(WRITEONLY); }
|
||||||
"varying" { pyylval->lex.line = yylineno; return(VARYING); }
|
|
||||||
"layout" { pyylval->lex.line = yylineno; return(LAYOUT); }
|
"layout" { pyylval->lex.line = yylineno; return(LAYOUT); }
|
||||||
|
|
||||||
|
"centroid" { pyylval->lex.line = yylineno; return(CENTROID); }
|
||||||
|
"flat" { pyylval->lex.line = yylineno; return(FLAT); }
|
||||||
|
"smooth" { pyylval->lex.line = yylineno; return(SMOOTH); }
|
||||||
|
"noperspective" { pyylval->lex.line = yylineno; return(NOPERSPECTIVE); }
|
||||||
|
|
||||||
|
"patch" { pyylval->lex.line = yylineno; return(PATCH); }
|
||||||
|
"sample" { pyylval->lex.line = yylineno; return(SAMPLE); }
|
||||||
|
|
||||||
"break" { pyylval->lex.line = yylineno; return(BREAK); }
|
"break" { pyylval->lex.line = yylineno; return(BREAK); }
|
||||||
"continue" { pyylval->lex.line = yylineno; return(CONTINUE); }
|
"continue" { pyylval->lex.line = yylineno; return(CONTINUE); }
|
||||||
"do" { pyylval->lex.line = yylineno; return(DO); }
|
"do" { pyylval->lex.line = yylineno; return(DO); }
|
||||||
@ -126,21 +139,19 @@ TSourceLoc yylineno;
|
|||||||
"if" { pyylval->lex.line = yylineno; return(IF); }
|
"if" { pyylval->lex.line = yylineno; return(IF); }
|
||||||
"else" { pyylval->lex.line = yylineno; return(ELSE); }
|
"else" { pyylval->lex.line = yylineno; return(ELSE); }
|
||||||
|
|
||||||
|
"subroutine" { pyylval->lex.line = yylineno; return(SUBROUTINE); }
|
||||||
|
|
||||||
"in" { pyylval->lex.line = yylineno; return(IN); }
|
"in" { pyylval->lex.line = yylineno; return(IN); }
|
||||||
"out" { pyylval->lex.line = yylineno; return(OUT); }
|
"out" { pyylval->lex.line = yylineno; return(OUT); }
|
||||||
"inout" { pyylval->lex.line = yylineno; return(INOUT); }
|
"inout" { pyylval->lex.line = yylineno; return(INOUT); }
|
||||||
"centroid" { pyylval->lex.line = yylineno; return(CENTROID); }
|
|
||||||
"noperspective" { pyylval->lex.line = yylineno; return(NOPERSPECTIVE); }
|
|
||||||
"flat" { pyylval->lex.line = yylineno; return(FLAT); }
|
|
||||||
"smooth" { pyylval->lex.line = yylineno; return(SMOOTH); }
|
|
||||||
|
|
||||||
"precise" { pyylval->lex.line = yylineno; return(PRECISE); }
|
"precise" { pyylval->lex.line = yylineno; return(PRECISE); }
|
||||||
"invariant" { pyylval->lex.line = yylineno; return(INVARIANT); }
|
"invariant" { pyylval->lex.line = yylineno; return(INVARIANT); }
|
||||||
|
|
||||||
"precision" { pyylval->lex.line = yylineno; return(PRECISION); }
|
"highp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, HIGH_PRECISION); }
|
||||||
"highp" { pyylval->lex.line = yylineno; return(HIGH_PRECISION); }
|
"mediump" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, MEDIUM_PRECISION); }
|
||||||
"mediump" { pyylval->lex.line = yylineno; return(MEDIUM_PRECISION); }
|
"lowp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, LOW_PRECISION); }
|
||||||
"lowp" { pyylval->lex.line = yylineno; return(LOW_PRECISION); }
|
"precision" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, PRECISION); }
|
||||||
|
|
||||||
"float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT); }
|
"float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT); }
|
||||||
"double" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DOUBLE); }
|
"double" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DOUBLE); }
|
||||||
@ -153,50 +164,50 @@ TSourceLoc yylineno;
|
|||||||
|
|
||||||
"discard" { pyylval->lex.line = yylineno; return(DISCARD); }
|
"discard" { pyylval->lex.line = yylineno; return(DISCARD); }
|
||||||
"return" { pyylval->lex.line = yylineno; return(RETURN); }
|
"return" { pyylval->lex.line = yylineno; return(RETURN); }
|
||||||
"subroutine" { pyylval->lex.line = yylineno; return(SUBROUTINE); }
|
|
||||||
|
|
||||||
"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2); }
|
|
||||||
"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3); }
|
|
||||||
"mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4); }
|
|
||||||
|
|
||||||
"mat2x2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2X2); }
|
|
||||||
"mat2x3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2X3); }
|
|
||||||
"mat2x4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2X4); }
|
|
||||||
"mat3x2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3X2); }
|
|
||||||
"mat3x3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3X3); }
|
|
||||||
"mat3x4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3X4); }
|
|
||||||
"mat4x2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4X2); }
|
|
||||||
"mat4x3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4X3); }
|
|
||||||
"mat4x4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4X4); }
|
|
||||||
"dmat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT2); }
|
|
||||||
"dmat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT3); }
|
|
||||||
"dmat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT4); }
|
|
||||||
"dmat2x2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT2X2); }
|
|
||||||
"dmat2x3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT2X3); }
|
|
||||||
"dmat2x4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT2X4); }
|
|
||||||
"dmat3x2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT3X2); }
|
|
||||||
"dmat3x3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT3X3); }
|
|
||||||
"dmat3x4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT3X4); }
|
|
||||||
"dmat4x2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT4X2); }
|
|
||||||
"dmat4x3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT4X3); }
|
|
||||||
"dmat4x4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DMAT4X4); }
|
|
||||||
"atomic_uint" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ATOMIC_UINT); }
|
"atomic_uint" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ATOMIC_UINT); }
|
||||||
|
|
||||||
"vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); }
|
"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2); }
|
||||||
"vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); }
|
"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3); }
|
||||||
"vec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC4); }
|
"mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4); }
|
||||||
"dvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC2); }
|
|
||||||
"dvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC3); }
|
"mat2x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X2); }
|
||||||
"dvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC4); }
|
"mat2x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X3); }
|
||||||
"ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); }
|
"mat2x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X4); }
|
||||||
"ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); }
|
"mat3x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X2); }
|
||||||
"ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }
|
"mat3x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X3); }
|
||||||
"uvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC2); }
|
"mat3x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X4); }
|
||||||
"uvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC3); }
|
"mat4x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X2); }
|
||||||
"uvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC4); }
|
"mat4x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X3); }
|
||||||
"bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); }
|
"mat4x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X4); }
|
||||||
"bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); }
|
"dmat2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2); }
|
||||||
"bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); }
|
"dmat3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3); }
|
||||||
|
"dmat4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4); }
|
||||||
|
"dmat2x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X2); }
|
||||||
|
"dmat2x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X3); }
|
||||||
|
"dmat2x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X4); }
|
||||||
|
"dmat3x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X2); }
|
||||||
|
"dmat3x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X3); }
|
||||||
|
"dmat3x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X4); }
|
||||||
|
"dmat4x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X2); }
|
||||||
|
"dmat4x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X3); }
|
||||||
|
"dmat4x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X4); }
|
||||||
|
|
||||||
|
"vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); }
|
||||||
|
"vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); }
|
||||||
|
"vec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC4); }
|
||||||
|
"dvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC2); }
|
||||||
|
"dvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC3); }
|
||||||
|
"dvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC4); }
|
||||||
|
"ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); }
|
||||||
|
"ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); }
|
||||||
|
"ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }
|
||||||
|
"uvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC2); }
|
||||||
|
"uvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC3); }
|
||||||
|
"uvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC4); }
|
||||||
|
"bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); }
|
||||||
|
"bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); }
|
||||||
|
"bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); }
|
||||||
|
|
||||||
"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; }
|
"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; }
|
||||||
"sampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }
|
"sampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }
|
||||||
@ -283,6 +294,8 @@ TSourceLoc yylineno;
|
|||||||
"this" { PaReservedWord(); return 0; }
|
"this" { PaReservedWord(); return 0; }
|
||||||
"packed" { PaReservedWord(); return 0; }
|
"packed" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
|
"resource" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
"goto" { PaReservedWord(); return 0; }
|
"goto" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
"inline" { PaReservedWord(); return 0; }
|
"inline" { PaReservedWord(); return 0; }
|
||||||
@ -299,6 +312,9 @@ TSourceLoc yylineno;
|
|||||||
"fixed" { PaReservedWord(); return 0; }
|
"fixed" { PaReservedWord(); return 0; }
|
||||||
"unsigned" { PaReservedWord(); return 0; }
|
"unsigned" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
|
"superp" { bool reserved = (parseContext.profile == EEsProfile || parseContext.version >= 130);
|
||||||
|
return PaIdentOrReserved(reserved, parseContext, yylineno, yytext, pyylval); }
|
||||||
|
|
||||||
"input" { PaReservedWord(); return 0; }
|
"input" { PaReservedWord(); return 0; }
|
||||||
"output" { PaReservedWord(); return 0; }
|
"output" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
@ -309,7 +325,9 @@ TSourceLoc yylineno;
|
|||||||
"fvec3" { PaReservedWord(); return 0; }
|
"fvec3" { PaReservedWord(); return 0; }
|
||||||
"fvec4" { PaReservedWord(); return 0; }
|
"fvec4" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
"sampler3DRect" { PaReservedWord(); return 0; }
|
"sampler3DRect" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
|
"filter" { PaReservedWord(); return 0; }
|
||||||
|
|
||||||
"sizeof" { PaReservedWord(); return 0; }
|
"sizeof" { PaReservedWord(); return 0; }
|
||||||
"cast" { PaReservedWord(); return 0; }
|
"cast" { PaReservedWord(); return 0; }
|
||||||
@ -493,11 +511,11 @@ void yyerror(char *s)
|
|||||||
|
|
||||||
if (parseContext.AfterEOF) {
|
if (parseContext.AfterEOF) {
|
||||||
if (cpp->tokensBeforeEOF == 1) {
|
if (cpp->tokensBeforeEOF == 1) {
|
||||||
GlobalParseContext->error(yylineno, "syntax error", "pre-mature EOF", s, "");
|
GlobalParseContext->error(yylineno, "", "pre-mature EOF", s, "");
|
||||||
GlobalParseContext->recover();
|
GlobalParseContext->recover();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GlobalParseContext->error(yylineno, "syntax error", yytext, s, "");
|
GlobalParseContext->error(yylineno, "", yytext, s, "");
|
||||||
GlobalParseContext->recover();
|
GlobalParseContext->recover();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,7 +540,56 @@ int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbo
|
|||||||
return IDENTIFIER;
|
return IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaParseComment(int &lineno, TParseContext& parseContextLocal)
|
int PaIdentOrReserved(bool reserved, TParseContext& parseContext, int line, char* text, YYSTYPE* pyylval)
|
||||||
|
{
|
||||||
|
if (reserved)
|
||||||
|
PaReservedWord();
|
||||||
|
|
||||||
|
pyylval->lex.line = line;
|
||||||
|
pyylval->lex.string = NewPoolTString(text);
|
||||||
|
|
||||||
|
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PaPrecisionKeyword(TParseContext& parseContext, int line, char* text, YYSTYPE* pyylval, int keyword)
|
||||||
|
{
|
||||||
|
if (parseContext.profile == EEsProfile || parseContext.version >= 130)
|
||||||
|
return keyword;
|
||||||
|
|
||||||
|
pyylval->lex.line = line;
|
||||||
|
pyylval->lex.string = NewPoolTString(text);
|
||||||
|
|
||||||
|
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PaMatNxM(TParseContext& parseContext, int line, char* text, YYSTYPE* pyylval, int keyword)
|
||||||
|
{
|
||||||
|
if (parseContext.version > 110)
|
||||||
|
return keyword;
|
||||||
|
|
||||||
|
pyylval->lex.line = line;
|
||||||
|
pyylval->lex.string = NewPoolTString(text);
|
||||||
|
|
||||||
|
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PaDMat(TParseContext& parseContext, int line, char* text, YYSTYPE* pyylval, int keyword)
|
||||||
|
{
|
||||||
|
if (parseContext.profile == EEsProfile && parseContext.version >= 300) {
|
||||||
|
PaReservedWord();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parseContext.profile != EEsProfile && parseContext.version >= 400)
|
||||||
|
return keyword;
|
||||||
|
|
||||||
|
pyylval->lex.line = line;
|
||||||
|
pyylval->lex.string = NewPoolTString(text);
|
||||||
|
|
||||||
|
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PaParseComment(int& lineno, TParseContext& parseContextLocal)
|
||||||
{
|
{
|
||||||
int transitionFlag = 0;
|
int transitionFlag = 0;
|
||||||
int nextChar;
|
int nextChar;
|
||||||
|
@ -73,6 +73,7 @@ Jutta Degener, 1995
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
struct {
|
struct {
|
||||||
TSourceLoc line;
|
TSourceLoc line;
|
||||||
@ -1664,6 +1665,7 @@ storage_qualifier
|
|||||||
|
|
||||||
parseContext.checkDeprecated($1.line, ENoProfile, 140, "attribute");
|
parseContext.checkDeprecated($1.line, ENoProfile, 140, "attribute");
|
||||||
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute");
|
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute");
|
||||||
|
parseContext.requireNotRemoved($1.line, EEsProfile, 300, "attribute");
|
||||||
|
|
||||||
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
|
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
|
||||||
parseContext.recover();
|
parseContext.recover();
|
||||||
@ -1674,6 +1676,7 @@ storage_qualifier
|
|||||||
| VARYING {
|
| VARYING {
|
||||||
parseContext.checkDeprecated($1.line, ENoProfile, 140, "varying");
|
parseContext.checkDeprecated($1.line, ENoProfile, 140, "varying");
|
||||||
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying");
|
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying");
|
||||||
|
parseContext.requireNotRemoved($1.line, EEsProfile, 300, "varying");
|
||||||
|
|
||||||
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
|
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
|
||||||
parseContext.recover();
|
parseContext.recover();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user