diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/emit.cpp | 2 | ||||
| -rw-r--r-- | source/slang/lexer.cpp | 20 | ||||
| -rw-r--r-- | source/slang/parser.cpp | 36 | ||||
| -rw-r--r-- | source/slang/preprocessor.cpp | 18 | ||||
| -rw-r--r-- | source/slang/token-defs.h | 8 |
5 files changed, 42 insertions, 42 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 77b0c2fe9..5272204f6 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -487,7 +487,7 @@ static String getStringOrIdentifierTokenValue( case TokenType::Identifier: return token.Content; - case TokenType::StringLiterial: + case TokenType::StringLiteral: return getStringLiteralTokenValue(token); break; } diff --git a/source/slang/lexer.cpp b/source/slang/lexer.cpp index f81ead87c..73fbb9605 100644 --- a/source/slang/lexer.cpp +++ b/source/slang/lexer.cpp @@ -370,7 +370,7 @@ namespace Slang { case 'f': case 'F': advance(lexer); - return TokenType::DoubleLiterial; + return TokenType::FloatingPointLiteral; default: break; @@ -453,21 +453,21 @@ namespace Slang lexDigits(lexer, base); maybeLexNumberExponent(lexer, base); - return maybeLexNumberSuffix(lexer, TokenType::DoubleLiterial); + return maybeLexNumberSuffix(lexer, TokenType::FloatingPointLiteral); } static TokenType lexNumber(Lexer* lexer, int base) { // TODO(tfoley): Need to consider whehter to allow any kind of digit separator character. - TokenType tokenType = TokenType::IntLiterial; + TokenType tokenType = TokenType::IntegerLiteral; // At the start of things, we just concern ourselves with digits lexDigits(lexer, base); if( peek(lexer) == '.' ) { - tokenType = TokenType::DoubleLiterial; + tokenType = TokenType::FloatingPointLiteral; advance(lexer); lexDigits(lexer, base); @@ -475,7 +475,7 @@ namespace Slang if( maybeLexNumberExponent(lexer, base)) { - tokenType = TokenType::DoubleLiterial; + tokenType = TokenType::FloatingPointLiteral; } maybeLexNumberSuffix(lexer, tokenType); @@ -575,8 +575,8 @@ namespace Slang String getStringLiteralTokenValue(Token const& token) { - assert(token.Type == TokenType::StringLiterial - || token.Type == TokenType::CharLiterial); + assert(token.Type == TokenType::StringLiteral + || token.Type == TokenType::CharLiteral); char const* cursor = token.Content.begin(); char const* end = token.Content.end(); @@ -758,7 +758,7 @@ namespace Slang switch(peek(lexer)) { default: - return TokenType::IntLiterial; + return TokenType::IntegerLiteral; case '.': advance(lexer); @@ -798,12 +798,12 @@ namespace Slang case '\"': advance(lexer); lexStringLiteralBody(lexer, '\"'); - return TokenType::StringLiterial; + return TokenType::StringLiteral; case '\'': advance(lexer); lexStringLiteralBody(lexer, '\''); - return TokenType::CharLiterial; + return TokenType::CharLiteral; case '+': advance(lexer); diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 3ffbc1263..5e93d63cb 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -630,7 +630,7 @@ namespace Slang modifier->Position = loc; parser->ReadToken(TokenType::LParent); - if (parser->LookAheadToken(TokenType::IntLiterial)) + if (parser->LookAheadToken(TokenType::IntegerLiteral)) { modifier->op = (IntrinsicOp)StringToInt(parser->ReadToken().Content); } @@ -662,7 +662,7 @@ namespace Slang if( AdvanceIf(parser, TokenType::Comma) ) { - if( parser->LookAheadToken(TokenType::StringLiterial) ) + if( parser->LookAheadToken(TokenType::StringLiteral) ) { modifier->definitionToken = parser->ReadToken(); } @@ -708,7 +708,7 @@ namespace Slang if(AdvanceIf(parser, TokenType::OpAssign)) { - modifier->valToken = parser->ReadToken(TokenType::IntLiterial); + modifier->valToken = parser->ReadToken(TokenType::IntegerLiteral); } AddModifier(&modifierLink, modifier); @@ -726,7 +726,7 @@ namespace Slang { RefPtr<BuiltinTypeModifier> modifier = new BuiltinTypeModifier(); parser->ReadToken(TokenType::LParent); - modifier->tag = BaseType(StringToInt(parser->ReadToken(TokenType::IntLiterial).Content)); + modifier->tag = BaseType(StringToInt(parser->ReadToken(TokenType::IntegerLiteral).Content)); parser->ReadToken(TokenType::RParent); AddModifier(&modifierLink, modifier); @@ -738,7 +738,7 @@ namespace Slang modifier->name = parser->ReadToken(TokenType::Identifier).Content; if (AdvanceIf(parser, TokenType::Comma)) { - modifier->tag = uint32_t(StringToInt(parser->ReadToken(TokenType::IntLiterial).Content)); + modifier->tag = uint32_t(StringToInt(parser->ReadToken(TokenType::IntegerLiteral).Content)); } parser->ReadToken(TokenType::RParent); @@ -807,9 +807,9 @@ namespace Slang auto decl = new ImportDecl(); decl->scope = parser->currentScope; - if (peekTokenType(parser) == TokenType::StringLiterial) + if (peekTokenType(parser) == TokenType::StringLiteral) { - auto nameToken = parser->ReadToken(TokenType::StringLiterial); + auto nameToken = parser->ReadToken(TokenType::StringLiteral); nameToken.Content = getStringLiteralTokenValue(nameToken); decl->nameToken = nameToken; } @@ -3213,18 +3213,18 @@ namespace Slang return initExpr; } - case TokenType::IntLiterial: - case TokenType::DoubleLiterial: + case TokenType::IntegerLiteral: + case TokenType::FloatingPointLiteral: { RefPtr<ConstantExpressionSyntaxNode> constExpr = new ConstantExpressionSyntaxNode(); auto token = parser->tokenReader.AdvanceToken(); parser->FillPosition(constExpr.Ptr()); - if (token.Type == TokenType::IntLiterial) + if (token.Type == TokenType::IntegerLiteral) { constExpr->ConstType = ConstantExpressionSyntaxNode::ConstantType::Int; constExpr->IntValue = StringToInt(token.Content); } - else if (token.Type == TokenType::DoubleLiterial) + else if (token.Type == TokenType::FloatingPointLiteral) { constExpr->ConstType = ConstantExpressionSyntaxNode::ConstantType::Float; constExpr->FloatValue = (FloatingPointLiteralValue) StringToDouble(token.Content); @@ -3233,14 +3233,14 @@ namespace Slang return constExpr; } - case TokenType::StringLiterial: + case TokenType::StringLiteral: { RefPtr<ConstantExpressionSyntaxNode> constExpr = new ConstantExpressionSyntaxNode(); auto token = parser->tokenReader.AdvanceToken(); parser->FillPosition(constExpr.Ptr()); constExpr->ConstType = ConstantExpressionSyntaxNode::ConstantType::String; - if (!parser->LookAheadToken(TokenType::StringLiterial)) + if (!parser->LookAheadToken(TokenType::StringLiteral)) { // Easy/common case: a single string constExpr->stringValue = getStringLiteralTokenValue(token); @@ -3249,7 +3249,7 @@ namespace Slang { StringBuilder sb; sb << getStringLiteralTokenValue(token); - while (parser->LookAheadToken(TokenType::StringLiterial)) + while (parser->LookAheadToken(TokenType::StringLiteral)) { token = parser->tokenReader.AdvanceToken(); sb << getStringLiteralTokenValue(token); @@ -3467,18 +3467,18 @@ namespace Slang rs = initExpr; } - else if (LookAheadToken(TokenType::IntLiterial) || - LookAheadToken(TokenType::DoubleLiterial)) + else if (LookAheadToken(TokenType::IntegerLiteral) || + LookAheadToken(TokenType::FloatingPointLiteral)) { RefPtr<ConstantExpressionSyntaxNode> constExpr = new ConstantExpressionSyntaxNode(); auto token = tokenReader.AdvanceToken(); FillPosition(constExpr.Ptr()); - if (token.Type == TokenType::IntLiterial) + if (token.Type == TokenType::IntegerLiteral) { constExpr->ConstType = ConstantExpressionSyntaxNode::ConstantType::Int; constExpr->IntValue = StringToInt(token.Content); } - else if (token.Type == TokenType::DoubleLiterial) + else if (token.Type == TokenType::FloatingPointLiteral) { constExpr->ConstType = ConstantExpressionSyntaxNode::ConstantType::Float; constExpr->FloatValue = (FloatingPointLiteralValue) StringToDouble(token.Content); diff --git a/source/slang/preprocessor.cpp b/source/slang/preprocessor.cpp index 084f518fb..f84355018 100644 --- a/source/slang/preprocessor.cpp +++ b/source/slang/preprocessor.cpp @@ -1083,7 +1083,7 @@ static PreprocessorExpressionValue ParseAndEvaluateUnaryExpression(PreprocessorD return value; } - case TokenType::IntLiterial: + case TokenType::IntegerLiteral: return StringToInt(AdvanceToken(context).Content); case TokenType::Identifier: @@ -1488,7 +1488,7 @@ static void HandleImportDirective(PreprocessorDirectiveContext* context); static void HandleIncludeDirective(PreprocessorDirectiveContext* context) { Token pathToken; - if(!Expect(context, TokenType::StringLiterial, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken)) + if(!Expect(context, TokenType::StringLiteral, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken)) return; String path = getFileNameTokenValue(pathToken); @@ -1656,7 +1656,7 @@ static void HandleErrorDirective(PreprocessorDirectiveContext* context) static void HandleLineDirective(PreprocessorDirectiveContext* context) { int line = 0; - if (PeekTokenType(context) == TokenType::IntLiterial) + if (PeekTokenType(context) == TokenType::IntegerLiteral) { line = StringToInt(AdvanceToken(context).Content); } @@ -1672,7 +1672,7 @@ static void HandleLineDirective(PreprocessorDirectiveContext* context) else { GetSink(context)->diagnose(PeekLoc(context), Diagnostics::expected2TokensInPreprocessorDirective, - TokenType::IntLiterial, + TokenType::IntegerLiteral, "default", GetDirectiveName(context)); context->parseError = true; @@ -1686,11 +1686,11 @@ static void HandleLineDirective(PreprocessorDirectiveContext* context) { file = directiveLoc.FileName; } - else if (PeekTokenType(context) == TokenType::StringLiterial) + else if (PeekTokenType(context) == TokenType::StringLiteral) { file = AdvanceToken(context).Content; } - else if (PeekTokenType(context) == TokenType::IntLiterial) + else if (PeekTokenType(context) == TokenType::IntegerLiteral) { // Note(tfoley): GLSL allows the "source string" to be indicated by an integer // TODO(tfoley): Figure out a better way to handle this, if it matters @@ -1698,7 +1698,7 @@ static void HandleLineDirective(PreprocessorDirectiveContext* context) } else { - Expect(context, TokenType::StringLiterial, Diagnostics::expectedTokenInPreprocessorDirective); + Expect(context, TokenType::StringLiteral, Diagnostics::expectedTokenInPreprocessorDirective); return; } @@ -1723,7 +1723,7 @@ static void handleGLSLVersionDirective(PreprocessorDirectiveContext* context) Token versionNumberToken; if(!ExpectRaw( context, - TokenType::IntLiterial, + TokenType::IntegerLiteral, Diagnostics::expectedTokenInPreprocessorDirective, &versionNumberToken)) { @@ -2090,7 +2090,7 @@ TokenList preprocessSource( static void HandleImportDirective(PreprocessorDirectiveContext* context) { Token pathToken; - if(!Expect(context, TokenType::StringLiterial, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken)) + if(!Expect(context, TokenType::StringLiteral, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken)) return; String path = getFileNameTokenValue(pathToken); diff --git a/source/slang/token-defs.h b/source/slang/token-defs.h index 0fe833e36..08f67f996 100644 --- a/source/slang/token-defs.h +++ b/source/slang/token-defs.h @@ -21,10 +21,10 @@ TOKEN(EndOfFile, "end of file") TOKEN(EndOfDirective, "end of line") TOKEN(Invalid, "invalid character") TOKEN(Identifier, "identifier") -TOKEN(IntLiterial, "integer literal") -TOKEN(DoubleLiterial, "floating-point literal") -TOKEN(StringLiterial, "string literal") -TOKEN(CharLiterial, "character literal") +TOKEN(IntegerLiteral, "integer literal") +TOKEN(FloatingPointLiteral, "floating-point literal") +TOKEN(StringLiteral, "string literal") +TOKEN(CharLiteral, "character literal") TOKEN(WhiteSpace, "whitespace") TOKEN(NewLine, "newline") TOKEN(LineComment, "line comment") |
