summaryrefslogtreecommitdiffstats
path: root/source/slang/lexer.cpp
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2017-07-19 18:52:38 -0700
committerGitHub <noreply@github.com>2017-07-19 18:52:38 -0700
commitf07c01ceb012b9b325a8ecebd12cdd5797d8d5b3 (patch)
tree0b93a109d51e6565560ad785519a863386490e2a /source/slang/lexer.cpp
parenta2b8b4c20632d79721052abd232fe2d1bdf2700d (diff)
parent3f48e1c0d84bf4909954154ad147559656e87516 (diff)
Merge pull request #128 from tfoleyNV/improve-failure-modes
Try to improve handling of failures during compilation
Diffstat (limited to 'source/slang/lexer.cpp')
-rw-r--r--source/slang/lexer.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/slang/lexer.cpp b/source/slang/lexer.cpp
index d8211fb20..49856c1c9 100644
--- a/source/slang/lexer.cpp
+++ b/source/slang/lexer.cpp
@@ -11,14 +11,14 @@ namespace Slang
Token* TokenList::begin() const
{
- assert(mTokens.Count());
+ SLANG_ASSERT(mTokens.Count());
return &mTokens[0];
}
Token* TokenList::end() const
{
- assert(mTokens.Count());
- assert(mTokens[mTokens.Count()-1].Type == TokenType::EndOfFile);
+ SLANG_ASSERT(mTokens.Count());
+ SLANG_ASSERT(mTokens[mTokens.Count()-1].Type == TokenType::EndOfFile);
return &mTokens[mTokens.Count() - 1];
}
@@ -48,7 +48,7 @@ namespace Slang
{
if (mCursor == mEnd)
return TokenType::EndOfFile;
- assert(mCursor);
+ SLANG_ASSERT(mCursor);
return mCursor->Type;
}
@@ -56,7 +56,7 @@ namespace Slang
{
if (!mCursor)
return CodePosition();
- assert(mCursor);
+ SLANG_ASSERT(mCursor);
return mCursor->Position;
}
@@ -135,7 +135,7 @@ namespace Slang
//
static void handleNewLineInner(Lexer* lexer, int c)
{
- assert(c == '\n' || c == '\r');
+ SLANG_ASSERT(c == '\n' || c == '\r');
int d = peekRaw(lexer);
if( (c ^ d) == ('\n' ^ '\r') )
@@ -774,26 +774,26 @@ namespace Slang
String getStringLiteralTokenValue(Token const& token)
{
- assert(token.Type == TokenType::StringLiteral
+ SLANG_ASSERT(token.Type == TokenType::StringLiteral
|| token.Type == TokenType::CharLiteral);
char const* cursor = token.Content.begin();
char const* end = token.Content.end();
auto quote = *cursor++;
- assert(quote == '\'' || quote == '"');
+ SLANG_ASSERT(quote == '\'' || quote == '"');
StringBuilder valueBuilder;
for(;;)
{
- assert(cursor != end);
+ SLANG_ASSERT(cursor != end);
auto c = *cursor++;
// If we see a closing quote, then we are at the end of the string literal
if(c == quote)
{
- assert(cursor == end);
+ SLANG_ASSERT(cursor == end);
return valueBuilder.ProduceString();
}