Skip to content

Commit

Permalink
Merge 07a4e4d into 9132133
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardt committed Jun 21, 2019
2 parents 9132133 + 07a4e4d commit f1bee30
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/verilogAST.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ class Port : public Node {

class Statement : public Node {};

class SingleLineComment : public Statement {
std::string value;

public:
SingleLineComment(std::string value) : value(value){};
std::string toString() { return "// " + value; };
};

class BlockComment : public Statement {
std::string value;

public:
BlockComment(std::string value) : value(value){};
std::string toString() { return "/*\n" + value + "\n*/"; };
};

class BehavioralStatement : public Statement {};
class StructuralStatement : public Statement {};

Expand Down
7 changes: 7 additions & 0 deletions tests/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,13 @@ TEST(BasicTests, File) {
".c(c[32'd31:32'd0]));\nendmodule\n";
EXPECT_EQ(file.toString(), expected_str);
}
TEST(BasicTests, Comment) {
vAST::SingleLineComment single_line_comment("Test comment");
EXPECT_EQ(single_line_comment.toString(), "// Test comment");
vAST::BlockComment block_comment("Test comment\non multiple lines");
EXPECT_EQ(block_comment.toString(), "/*\nTest comment\non multiple lines\n*/");
}


} // namespace

Expand Down

0 comments on commit f1bee30

Please sign in to comment.