Skip to content

Commit

Permalink
Lexer: endCol is just col
Browse files Browse the repository at this point in the history
  • Loading branch information
wpmed92 committed Aug 7, 2024
1 parent e9f1245 commit 780b945
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions lib/Lexer/Lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ bool Lexer::handleIdentifier(Error &error) {
tok->setTokenKind(TokenKind::Identifier);
}

int endCol = col;
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, endCol));
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, col));
tok->setRawData(token);
tokenStream.push_back(std::move(tok));

Expand Down Expand Up @@ -162,8 +161,7 @@ bool Lexer::handleHexLiteral(Error &error) {

tok->setTokenKind(isUnsigned ? TokenKind::UnsignedIntegerConstant
: TokenKind::IntegerConstant);
int endCol = col;
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, endCol));
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, col));
tok->setRawData(literalConstant);
tokenStream.push_back(std::move(tok));

Expand Down Expand Up @@ -212,9 +210,7 @@ bool Lexer::handleOctalLiteral(Error &error) {

tok->setTokenKind(isUnsigned ? TokenKind::UnsignedIntegerConstant
: TokenKind::IntegerConstant);

int endCol = col;
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, endCol));
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, col));
tok->setRawData(literalConstant);
tokenStream.push_back(std::move(tok));

Expand Down Expand Up @@ -276,8 +272,7 @@ bool Lexer::handleDecimalOrFloatLiteral(Error &error) {
std::make_unique<FloatLiteral>(std::stof(literalConstant)));
}

int endCol = col;
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, endCol));
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, col));
tok->setRawData(literalConstant);
tokenStream.push_back(std::move(tok));
return true;
Expand All @@ -296,8 +291,7 @@ bool Lexer::handleDecimalOrFloatLiteral(Error &error) {
tok->setTokenKind(TokenKind::IntegerConstant);
}

int endCol = col;
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, endCol));
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, col));
tok->setRawData(literalConstant);
tokenStream.push_back(std::move(tok));
return true;
Expand Down Expand Up @@ -353,8 +347,7 @@ bool Lexer::handleExponentialForm(std::string &literalConstant, Error &error) {
tok->setTokenKind(TokenKind::FloatConstant);
}

int endCol = col;
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, endCol));
tok->setSourceLocation(ast::SourceLocation(lineNum, startCol, lineNum, col));
tok->setRawData(literalConstant);
tokenStream.push_back(std::move(tok));

Expand Down

0 comments on commit 780b945

Please sign in to comment.