Re-allow non-language characters in ES 100 comments, including '\', except for '\' just before a new line.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24331 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
34bd4fbef7
commit
e1f0f5b31f
@ -36,7 +36,7 @@ void main()
|
|||||||
for ( int a = 0; a <= 20; a++) { if (ga==0) a = 4; } // ERROR
|
for ( int a = 0; a <= 20; a++) { if (ga==0) a = 4; } // ERROR
|
||||||
for (float a = 0.0; a <= 20.0; a += 2.0);
|
for (float a = 0.0; a <= 20.0; a += 2.0);
|
||||||
for (float a = 0.0; a != 20.0; a -= 2.0) { if (ga==0) ga = 4; }
|
for (float a = 0.0; a != 20.0; a -= 2.0) { if (ga==0) ga = 4; }
|
||||||
for (float a = 0.0; a == 20.0; a--) for (float a = 0.0; a == 20.0; a--); // two different a, everything okay
|
for (float a = 0.0; a == 20.0; a--) for (float a = 0.0; a == 20.0; a--); // two different 'a's, everything okay
|
||||||
for (float a = 0.0; a <= 20.0; a += 2.0);
|
for (float a = 0.0; a <= 20.0; a += 2.0);
|
||||||
for (float a = 0.0; a <= 20.0; a += 2.0);
|
for (float a = 0.0; a <= 20.0; a += 2.0);
|
||||||
for (float a = 0.0; a > 2.0 * 20.0; a += v3.y);
|
for (float a = 0.0; a > 2.0 * 20.0; a += v3.y);
|
||||||
|
@ -18,8 +18,8 @@ float b(int a); // ERROR: redefinition
|
|||||||
|
|
||||||
float f; // ERROR: redefinition
|
float f; // ERROR: redefinition
|
||||||
float tan; // okay, built-in is in an outer scope
|
float tan; // okay, built-in is in an outer scope
|
||||||
float sin(float x); // ERROR: cant redefine built-in functions
|
float sin(float x); // ERROR: can't redefine built-in functions
|
||||||
float cos(float x) // ERROR: cant redefine built-in functions
|
float cos(float x) // ERROR: can't redefine built-in functions
|
||||||
{
|
{
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ void main()
|
|||||||
int z = z; // ERROR: z not previously defined.
|
int z = z; // ERROR: z not previously defined.
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
int x = x; // x is initialized to 1
|
int x = x; // x is initialized to '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
struct S
|
struct S
|
||||||
@ -62,7 +62,7 @@ void main()
|
|||||||
int x;
|
int x;
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
S S = S(0); // S is only visible as a struct and constructor
|
S S = S(0); // 'S' is only visible as a struct and constructor
|
||||||
S.x; // S is now visible as a variable
|
S.x; // 'S' is now visible as a variable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,7 @@ ERROR: 0:14: 'line continuation' : not supported for this version or the enabled
|
|||||||
ERROR: 0:15: 'line continuation' : not supported for this version or the enabled extensions
|
ERROR: 0:15: 'line continuation' : not supported for this version or the enabled extensions
|
||||||
ERROR: 0:18: '#error' : e3
|
ERROR: 0:18: '#error' : e3
|
||||||
ERROR: 0:24: 'line continuation' : not supported for this version or the enabled extensions
|
ERROR: 0:24: 'line continuation' : not supported for this version or the enabled extensions
|
||||||
ERROR: 0:28: 'line continuation' : not supported for this version or the enabled extensions
|
ERROR: 9 compilation errors. No code generated.
|
||||||
ERROR: 0:29: 'non-language character ($) in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 0:29: 'non-language character (") in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 0:29: 'non-language character (') in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 0:31: 'non-language character (@) in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 0:32: 'non-language character (@) in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 0:32: 'non-language character (@) in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 0:33: 'non-language character (@) in comment' : not supported for this version or the enabled extensions
|
|
||||||
ERROR: 17 compilation errors. No code generated.
|
|
||||||
|
|
||||||
|
|
||||||
ERROR: node is still EOpNull!
|
ERROR: node is still EOpNull!
|
||||||
|
@ -6,7 +6,7 @@ ains no errors other than the #error which are there to see if line numbering fo
|
|||||||
#error e1
|
#error e1
|
||||||
|
|
||||||
float f\
|
float f\
|
||||||
oo; // same as float foo;
|
oo; // same as 'float foo;'
|
||||||
|
|
||||||
#error e2
|
#error e2
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
// source have to figure out how to create revision.h just to get a build
|
// source have to figure out how to create revision.h just to get a build
|
||||||
// going. However, if it is not updated, it can be a version behind.
|
// going. However, if it is not updated, it can be a version behind.
|
||||||
|
|
||||||
#define GLSLANG_REVISION "24315"
|
#define GLSLANG_REVISION "24330"
|
||||||
#define GLSLANG_DATE "2013/12/03 21:47:57"
|
#define GLSLANG_DATE "2013/12/04 09:43:00"
|
||||||
|
@ -1413,28 +1413,6 @@ void TParseContext::lineContinuationCheck(TSourceLoc loc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// See if this version/profile allows use the given character in a comment.
|
|
||||||
//
|
|
||||||
void TParseContext::commentCharacterCheck(TSourceLoc loc, int ch)
|
|
||||||
{
|
|
||||||
if ((profile == EEsProfile && version >= 300) ||
|
|
||||||
(profile != EEsProfile))
|
|
||||||
return;
|
|
||||||
|
|
||||||
TString message("non-language character (");
|
|
||||||
if (ch > 32 && ch <= 126)
|
|
||||||
message.push_back(ch);
|
|
||||||
message.append(") in comment");
|
|
||||||
if (messages & EShMsgRelaxedErrors) {
|
|
||||||
warn(loc, "not allowed in this version", message.c_str(), "");
|
|
||||||
} else {
|
|
||||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, message.c_str());
|
|
||||||
profileRequires(loc, EEsProfile, 300, 0, message.c_str());
|
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 0, message.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TParseContext::builtInName(const TString& identifier)
|
bool TParseContext::builtInName(const TString& identifier)
|
||||||
{
|
{
|
||||||
return identifier.compare(0, 3, "gl_") == 0;
|
return identifier.compare(0, 3, "gl_") == 0;
|
||||||
|
@ -77,7 +77,6 @@ public:
|
|||||||
bool reservedErrorCheck(TSourceLoc, const TString&);
|
bool reservedErrorCheck(TSourceLoc, const TString&);
|
||||||
void reservedPpErrorCheck(TSourceLoc, const char* name, const char* op);
|
void reservedPpErrorCheck(TSourceLoc, const char* name, const char* op);
|
||||||
void lineContinuationCheck(TSourceLoc);
|
void lineContinuationCheck(TSourceLoc);
|
||||||
void commentCharacterCheck(TSourceLoc, int ch);
|
|
||||||
bool builtInName(const TString&);
|
bool builtInName(const TString&);
|
||||||
|
|
||||||
void handlePragma(TSourceLoc, const TVector<TString>&);
|
void handlePragma(TSourceLoc, const TVector<TString>&);
|
||||||
|
@ -188,7 +188,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
|||||||
if (token == '\\') {
|
if (token == '\\') {
|
||||||
parseContext.lineContinuationCheck(ppToken->loc);
|
parseContext.lineContinuationCheck(ppToken->loc);
|
||||||
token = currentInput->scan(this, currentInput, ppToken);
|
token = currentInput->scan(this, currentInput, ppToken);
|
||||||
if (token == '\n')
|
if (token == '\n' || token == '\r')
|
||||||
token = currentInput->scan(this, currentInput, ppToken);
|
token = currentInput->scan(this, currentInput, ppToken);
|
||||||
}
|
}
|
||||||
RecordToken(mac.body, token, ppToken);
|
RecordToken(mac.body, token, ppToken);
|
||||||
|
@ -93,46 +93,48 @@ TPpContext::TPpContext(TParseContext& pc) :
|
|||||||
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
|
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
|
||||||
elseSeen[elsetracker] = false;
|
elseSeen[elsetracker] = false;
|
||||||
elsetracker = 0;
|
elsetracker = 0;
|
||||||
|
|
||||||
|
// The following identifies all legal characters in GLSL:
|
||||||
|
|
||||||
for (int c = 0; c < 256; ++c)
|
//for (int c = 0; c < 256; ++c)
|
||||||
languageCharacters[c] = false;
|
// languageCharacters[c] = false;
|
||||||
for (int c = 'a'; c <= 'z'; ++c)
|
//for (int c = 'a'; c <= 'z'; ++c)
|
||||||
languageCharacters[c] = true;
|
// languageCharacters[c] = true;
|
||||||
for (int c = 'A'; c <= 'Z'; ++c)
|
//for (int c = 'A'; c <= 'Z'; ++c)
|
||||||
languageCharacters[c] = true;
|
// languageCharacters[c] = true;
|
||||||
languageCharacters['_'] = true;
|
//languageCharacters['_'] = true;
|
||||||
for (int c = '0'; c <= '9'; ++c)
|
//for (int c = '0'; c <= '9'; ++c)
|
||||||
languageCharacters[c] = true;
|
// languageCharacters[c] = true;
|
||||||
languageCharacters['.'] = true;
|
//languageCharacters['.'] = true;
|
||||||
languageCharacters['+'] = true;
|
//languageCharacters['+'] = true;
|
||||||
languageCharacters['-'] = true;
|
//languageCharacters['-'] = true;
|
||||||
languageCharacters['/'] = true;
|
//languageCharacters['/'] = true;
|
||||||
languageCharacters['*'] = true;
|
//languageCharacters['*'] = true;
|
||||||
languageCharacters['%'] = true;
|
//languageCharacters['%'] = true;
|
||||||
languageCharacters['<'] = true;
|
//languageCharacters['<'] = true;
|
||||||
languageCharacters['>'] = true;
|
//languageCharacters['>'] = true;
|
||||||
languageCharacters['['] = true;
|
//languageCharacters['['] = true;
|
||||||
languageCharacters[']'] = true;
|
//languageCharacters[']'] = true;
|
||||||
languageCharacters['('] = true;
|
//languageCharacters['('] = true;
|
||||||
languageCharacters[')'] = true;
|
//languageCharacters[')'] = true;
|
||||||
languageCharacters['{'] = true;
|
//languageCharacters['{'] = true;
|
||||||
languageCharacters['}'] = true;
|
//languageCharacters['}'] = true;
|
||||||
languageCharacters['^'] = true;
|
//languageCharacters['^'] = true;
|
||||||
languageCharacters['|'] = true;
|
//languageCharacters['|'] = true;
|
||||||
languageCharacters['&'] = true;
|
//languageCharacters['&'] = true;
|
||||||
languageCharacters['~'] = true;
|
//languageCharacters['~'] = true;
|
||||||
languageCharacters['='] = true;
|
//languageCharacters['='] = true;
|
||||||
languageCharacters['!'] = true;
|
//languageCharacters['!'] = true;
|
||||||
languageCharacters[':'] = true;
|
//languageCharacters[':'] = true;
|
||||||
languageCharacters[';'] = true;
|
//languageCharacters[';'] = true;
|
||||||
languageCharacters[','] = true;
|
//languageCharacters[','] = true;
|
||||||
languageCharacters['?'] = true;
|
//languageCharacters['?'] = true;
|
||||||
languageCharacters['#'] = true;
|
//languageCharacters['#'] = true;
|
||||||
|
|
||||||
// white space
|
//// white space
|
||||||
languageCharacters[' '] = true;
|
//languageCharacters[' '] = true;
|
||||||
for (int c = 9; c <= 13; ++c)
|
//for (int c = 9; c <= 13; ++c)
|
||||||
languageCharacters[c] = true;
|
// languageCharacters[c] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPpContext::~TPpContext()
|
TPpContext::~TPpContext()
|
||||||
|
@ -209,8 +209,6 @@ protected:
|
|||||||
InputSrc *currentInput;
|
InputSrc *currentInput;
|
||||||
bool errorOnVersion;
|
bool errorOnVersion;
|
||||||
|
|
||||||
bool languageCharacters[256];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// from Pp.cpp
|
// from Pp.cpp
|
||||||
//
|
//
|
||||||
|
@ -638,17 +638,16 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
|
|||||||
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
if (ch == '\\') {
|
if (ch == '\\') {
|
||||||
// allow an escaped newline, otherwise escapes in comments are meaningless
|
// allow an escaped newline, otherwise escapes in comments are meaningless
|
||||||
pp->parseContext.lineContinuationCheck(ppToken->loc);
|
|
||||||
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
if (ch == '\r' || ch == '\n') {
|
if (ch == '\r' || ch == '\n') {
|
||||||
|
pp->parseContext.lineContinuationCheck(ppToken->loc);
|
||||||
int nextch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
int nextch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
if (ch == '\r' && nextch == '\n')
|
if (ch == '\r' && nextch == '\n')
|
||||||
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
else
|
else
|
||||||
ch = nextch;
|
ch = nextch;
|
||||||
}
|
}
|
||||||
} else if (ch > 0 && ! pp->languageCharacters[ch])
|
}
|
||||||
pp->parseContext.commentCharacterCheck(ppToken->loc, ch);
|
|
||||||
} while (ch != '\n' && ch != EOF);
|
} while (ch != '\n' && ch != EOF);
|
||||||
if (ch == EOF)
|
if (ch == EOF)
|
||||||
return EOF;
|
return EOF;
|
||||||
@ -664,8 +663,7 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
|
|||||||
pp->parseContext.error(ppToken->loc, "EOF in comment", "comment", "");
|
pp->parseContext.error(ppToken->loc, "EOF in comment", "comment", "");
|
||||||
|
|
||||||
return EOF;
|
return EOF;
|
||||||
} else if (! pp->languageCharacters[ch])
|
}
|
||||||
pp->parseContext.commentCharacterCheck(ppToken->loc, ch);
|
|
||||||
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
}
|
}
|
||||||
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
@ -673,8 +671,7 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
|
|||||||
pp->parseContext.error(ppToken->loc, "EOF in comment", "comment", "");
|
pp->parseContext.error(ppToken->loc, "EOF in comment", "comment", "");
|
||||||
|
|
||||||
return EOF;
|
return EOF;
|
||||||
} else if (! pp->languageCharacters[ch])
|
}
|
||||||
pp->parseContext.commentCharacterCheck(ppToken->loc, ch);
|
|
||||||
} while (ch != '/');
|
} while (ch != '/');
|
||||||
if (nlcount)
|
if (nlcount)
|
||||||
return '\n';
|
return '\n';
|
||||||
@ -692,9 +689,8 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
|
|||||||
if (ch == '\\') {
|
if (ch == '\\') {
|
||||||
pp->parseContext.lineContinuationCheck(ppToken->loc);
|
pp->parseContext.lineContinuationCheck(ppToken->loc);
|
||||||
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
|
||||||
if (ch == '\n' || ch == EOF) {
|
if (ch == '\n' || ch == '\r' || ch == EOF)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (len < TPpToken::maxTokenLength) {
|
if (len < TPpToken::maxTokenLength) {
|
||||||
tokenText[len] = ch;
|
tokenText[len] = ch;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user