File tree Expand file tree Collapse file tree 12 files changed +175
-5
lines changed Expand file tree Collapse file tree 12 files changed +175
-5
lines changed Original file line number Diff line number Diff line change 4
4
#include " ./file.hpp"
5
5
#include " ./node.hpp"
6
6
7
+ #include " ./d_codes/D01.hpp"
8
+ #include " ./d_codes/D02.hpp"
9
+ #include " ./d_codes/D03.hpp"
10
+ #include " ./d_codes/Dnn.hpp"
11
+
7
12
#include " ./g_codes/G01.hpp"
8
13
#include " ./g_codes/G02.hpp"
9
14
#include " ./g_codes/G03.hpp"
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+ #include " gerber/ast/command.hpp"
3
+ #include < string>
4
+
5
+ namespace gerber {
6
+ class D01 : public Command {
7
+ public:
8
+ std::string getNodeName () const override ;
9
+ };
10
+ } // namespace gerber
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+ #include " gerber/ast/command.hpp"
3
+ #include < string>
4
+
5
+ namespace gerber {
6
+ class D02 : public Command {
7
+ public:
8
+ std::string getNodeName () const override ;
9
+ };
10
+ } // namespace gerber
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+ #include " gerber/ast/command.hpp"
3
+ #include < string>
4
+
5
+ namespace gerber {
6
+ class D03 : public Command {
7
+ public:
8
+ std::string getNodeName () const override ;
9
+ };
10
+ } // namespace gerber
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+ #include " gerber/ast/command.hpp"
3
+ #include < string>
4
+
5
+ namespace gerber {
6
+ class Dnn : public Command {
7
+ std::string aperture_id;
8
+
9
+ public:
10
+ Dnn (const std::string_view& aperture_id_);
11
+ std::string getNodeName () const override ;
12
+ std::string getApertureId () const ;
13
+ };
14
+ } // namespace gerber
Original file line number Diff line number Diff line change 1
1
#pragma once
2
- #include " fmt/format.h"
3
2
#include " gerber/ast/ast.hpp"
4
3
#include " gerber/errors.hpp"
5
- #include < algorithm>
6
4
#include < cstdint>
7
5
#include < memory>
8
6
#include < regex>
9
- #include < stdexcept>
10
7
#include < string>
11
8
#include < string_view>
12
9
#include < tuple>
@@ -25,6 +22,8 @@ namespace gerber {
25
22
std::string_view full_source;
26
23
location_t global_index;
27
24
// Regular expressions cache
25
+ // D-codes
26
+ std::regex d_code_regex{" ^[Dd]0*([1-9][0-9]*)\\ *" };
28
27
// G-codes
29
28
std::regex g_code_regex{" ^[Gg]0*([1-9][0-9]*)\\ *" };
30
29
std::regex g04_regex{" ^[Gg]0*4([^%*]+)\\ *" };
@@ -39,6 +38,7 @@ namespace gerber {
39
38
location_t parse_global (const std::string_view& source, const location_t & index);
40
39
[[noreturn]] void throw_syntax_error ();
41
40
offset_t parse_g_code (const std::string_view& gerber, const location_t & index);
41
+ offset_t parse_d_code (const std::string_view& source, const location_t & index);
42
42
43
43
template <typename coordinate_type>
44
44
offset_t parse_coordinate (const std::string_view& source, const location_t & index) {
Original file line number Diff line number Diff line change
1
+ #include " gerber/ast/d_codes/D01.hpp"
2
+
3
+ namespace gerber {
4
+ std::string D01::getNodeName () const {
5
+ return " D01" ;
6
+ }
7
+ } // namespace gerber
Original file line number Diff line number Diff line change
1
+ #include " gerber/ast/d_codes/D02.hpp"
2
+
3
+ namespace gerber {
4
+ std::string D02::getNodeName () const {
5
+ return " D02" ;
6
+ }
7
+ } // namespace gerber
Original file line number Diff line number Diff line change
1
+ #include " gerber/ast/d_codes/D03.hpp"
2
+
3
+ namespace gerber {
4
+ std::string D03::getNodeName () const {
5
+ return " D03" ;
6
+ }
7
+ } // namespace gerber
Original file line number Diff line number Diff line change
1
+ #include " gerber/ast/d_codes/Dnn.hpp"
2
+
3
+ namespace gerber {
4
+ Dnn::Dnn (const std::string_view& aperture_id_) :
5
+ aperture_id (aperture_id_) {}
6
+
7
+ std::string Dnn::getNodeName () const {
8
+ return " Dnn" ;
9
+ }
10
+
11
+ std::string Dnn::getApertureId () const {
12
+ return aperture_id;
13
+ }
14
+ } // namespace gerber
You can’t perform that action at this time.
0 commit comments