Skip to content

Commit

Permalink
Merge branch 'develop' into release-0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rturrado committed Jan 8, 2024
2 parents aa0afbc + 45da501 commit 40c5484
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
20 changes: 10 additions & 10 deletions include/cqasm-annotations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once

#include <string>

#include <cstdint>

namespace cqasm::annotations {

Expand All @@ -23,39 +23,39 @@ class SourceLocation {
/**
* The first line of the range, or 0 if unknown.
*/
uint32_t first_line;
std::uint32_t first_line;

/**
* The first column of the range, or 0 if unknown.
*/
uint32_t first_column;
std::uint32_t first_column;

/**
* The last line of the range, or 0 if unknown.
*/
uint32_t last_line;
std::uint32_t last_line;

/**
* The last column of the range, or 0 if unknown.
*/
uint32_t last_column;
std::uint32_t last_column;

/**
* Constructs a source location object.
*/
SourceLocation(
const std::string &filename,
uint32_t first_line = 0,
uint32_t first_column = 0,
uint32_t last_line = 0,
uint32_t last_column = 0
std::uint32_t first_line = 0,
std::uint32_t first_column = 0,
std::uint32_t last_line = 0,
std::uint32_t last_column = 0
);

/**
* Expands the location range to contain the given location in the source
* file.
*/
void expand_to_include(uint32_t line, uint32_t column = 1);
void expand_to_include(std::uint32_t line, std::uint32_t column = 1);

};

Expand Down
10 changes: 5 additions & 5 deletions src/cqasm-annotations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace annotations {
*/
SourceLocation::SourceLocation(
const std::string &filename,
uint32_t first_line,
uint32_t first_column,
uint32_t last_line,
uint32_t last_column
std::uint32_t first_line,
std::uint32_t first_column,
std::uint32_t last_line,
std::uint32_t last_column
) :
filename(filename),
first_line(first_line),
Expand All @@ -36,7 +36,7 @@ SourceLocation::SourceLocation(
* Expands the location range to contain the given location in the source
* file.
*/
void SourceLocation::expand_to_include(uint32_t line, uint32_t column) {
void SourceLocation::expand_to_include(std::uint32_t line, std::uint32_t column) {
if (line < first_line) {
first_line = line;
}
Expand Down
8 changes: 4 additions & 4 deletions src/v3x/BuildTreeGenAstVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void BuildTreeGenAstVisitor::setNodeAnnotation(ast::One<ast::Node> node, antlr4:
// We change it here to a one-based index, which is the more human-readable, and the common option in text editors
node->set_annotation(cqasm::annotations::SourceLocation{
file_name_,
static_cast<uint32_t>(token->getLine()),
static_cast<uint32_t>(token->getCharPositionInLine() + 1),
static_cast<uint32_t>(token->getLine()),
static_cast<uint32_t>(token->getCharPositionInLine() + 1 + token_size)
static_cast<std::uint32_t>(token->getLine()),
static_cast<std::uint32_t>(token->getCharPositionInLine() + 1),
static_cast<std::uint32_t>(token->getLine()),
static_cast<std::uint32_t>(token->getCharPositionInLine() + 1 + token_size)
});
}

Expand Down

0 comments on commit 40c5484

Please sign in to comment.