Skip to content

Commit

Permalink
Rename file and enhance parse error messages
Browse files Browse the repository at this point in the history
Renamed file src/gcode/ast/operators.cpp to src/gcode/ast/entries.cpp to better reflect its contents and role. Also, modified parse error messages to include the line that failed to parse. This change is meant to improve debugging capabilities. All instances of the filename in other scripts, like CMakeLists.txt, have been updated accordingly.

Contributes to CURA-10561
  • Loading branch information
jellespijker committed Oct 18, 2023
1 parent 8d36970 commit 15eb0de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ find_package(ctre REQUIRED)
# --- Setup the shared C++ mgjtp library ---
set(DULCIFICUM_SRC
src/gcode/ast/ast.cpp
src/gcode/ast/operators.cpp
src/gcode/ast/entries.cpp
src/gcode/parse.cpp

src/miracle_jtp/mgjtp_command_to_json.cpp
Expand Down
36 changes: 18 additions & 18 deletions src/gcode/ast/operators.cpp → src/gcode/ast/entries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BuildVolumeTemperature::BuildVolumeTemperature(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -37,7 +37,7 @@ FeatureType::FeatureType(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -54,7 +54,7 @@ G0::G0(size_t index, std::string line)
// clang-format on
if (X == std::nullopt && Y == std::nullopt && Z == std::nullopt && E == std::nullopt && F == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -71,7 +71,7 @@ G1::G1(size_t index, std::string line)
// clang-format on
if (X == std::nullopt && Y == std::nullopt && Z == std::nullopt && E == std::nullopt && F == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -85,7 +85,7 @@ G280::G280(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -101,7 +101,7 @@ G92::G92(size_t index, std::string line)
// clang-format on
if (X == std::nullopt && Y == std::nullopt && Z == std::nullopt && E == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -115,7 +115,7 @@ InitialTemperatureBuildPlate::InitialTemperatureBuildPlate(size_t index, std::st
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -129,7 +129,7 @@ InitialTemperatureExtruder::InitialTemperatureExtruder(size_t index, std::string
// clang-format on
if (T == std::nullopt && S == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -143,7 +143,7 @@ Layer::Layer(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -157,7 +157,7 @@ M104::M104(size_t index, std::string line)
// clang-format on
if (S == std::nullopt && T == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -171,7 +171,7 @@ M106::M106(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -186,7 +186,7 @@ M109::M109(size_t index, std::string line)
// clang-format on
if (S == std::nullopt && R == std::nullopt && T == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -200,7 +200,7 @@ M140::M140(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -214,7 +214,7 @@ M190::M190(size_t index, std::string line)
// clang-format on
if (S == std::nullopt && R == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -229,7 +229,7 @@ M204::M204(size_t index, std::string line)
// clang-format on
if (P == std::nullopt && T == std::nullopt && S == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -245,7 +245,7 @@ M205::M205(size_t index, std::string line)
// clang-format on
if (X == std::nullopt && Y == std::nullopt && Z == std::nullopt && E == std::nullopt)
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -259,7 +259,7 @@ Mesh::Mesh(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand All @@ -273,7 +273,7 @@ T::T(size_t index, std::string line)
}
else
{
throw std::runtime_error(fmt::format("Unable to parse lino: {}", index));
throw std::runtime_error(fmt::format("Unable to parse: [{}] {}", index, line));
}
}

Expand Down

0 comments on commit 15eb0de

Please sign in to comment.