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:
John Kessenich 2013-12-04 17:23:03 +00:00
parent 34bd4fbef7
commit e1f0f5b31f
11 changed files with 56 additions and 91 deletions

View file

@ -638,17 +638,16 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\\') {
// allow an escaped newline, otherwise escapes in comments are meaningless
pp->parseContext.lineContinuationCheck(ppToken->loc);
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\r' || ch == '\n') {
pp->parseContext.lineContinuationCheck(ppToken->loc);
int nextch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\r' && nextch == '\n')
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
else
ch = nextch;
}
} else if (ch > 0 && ! pp->languageCharacters[ch])
pp->parseContext.commentCharacterCheck(ppToken->loc, ch);
}
} while (ch != '\n' && ch != EOF);
if (ch == EOF)
return EOF;
@ -664,8 +663,7 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
pp->parseContext.error(ppToken->loc, "EOF in comment", "comment", "");
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);
@ -673,8 +671,7 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
pp->parseContext.error(ppToken->loc, "EOF in comment", "comment", "");
return EOF;
} else if (! pp->languageCharacters[ch])
pp->parseContext.commentCharacterCheck(ppToken->loc, ch);
}
} while (ch != '/');
if (nlcount)
return '\n';
@ -692,9 +689,8 @@ int TPpContext::sourceScan(TPpContext* pp, InputSrc*, TPpToken* ppToken)
if (ch == '\\') {
pp->parseContext.lineContinuationCheck(ppToken->loc);
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\n' || ch == EOF) {
if (ch == '\n' || ch == '\r' || ch == EOF)
break;
}
}
if (len < TPpToken::maxTokenLength) {
tokenText[len] = ch;