Skip to content

Commit

Permalink
feat: add comment into enum_constant and parameter (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Nov 24, 2023
1 parent 33103d4 commit e4bda11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe('cxx_parser', () => {
{
"__TYPE":"MemberVariable",
"access_specifier":"",
"comment":"",
"is_mutable":false,
"name":"a",
"type":{
Expand Down Expand Up @@ -126,6 +127,7 @@ describe('cxx_parser', () => {
{
"__TYPE":"MemberVariable",
"access_specifier":"",
"comment":"",
"is_mutable":false,
"name":"a",
"type":{
Expand Down Expand Up @@ -199,6 +201,7 @@ describe('cxx_parser', () => {
{
"__TYPE":"MemberVariable",
"access_specifier":"",
"comment":"",
"is_mutable":false,
"name":"a",
"type":{
Expand Down Expand Up @@ -268,6 +271,7 @@ describe('cxx_parser', () => {
"enum_constants": [
{
"__TYPE": "EnumConstant",
"comment":"",
"name": "A",
"source": "0",
"value": "0"
Expand Down Expand Up @@ -329,6 +333,7 @@ describe('cxx_parser', () => {
"enum_constants": [
{
"__TYPE": "EnumConstant",
"comment":"",
"name": "A",
"source": "0",
"value": "0"
Expand Down Expand Up @@ -456,6 +461,7 @@ describe('cxx_parser', () => {
{
"__TYPE":"MemberVariable",
"access_specifier":"",
"comment":"",
"is_mutable":false,
"name":"a",
"type":{
Expand Down
4 changes: 4 additions & 0 deletions cxx-parser/cxx/terra/include/terra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ namespace terra
SimpleType param_type;
to_simple_type(param_type, cpp_variable_base.type());
parameter.type = param_type;
parameter.comment = parse_comment(cpp_variable_base);

std::string default_value = "";
if (cpp_variable_base.default_value().has_value())
Expand Down Expand Up @@ -300,6 +301,7 @@ namespace terra
{
EnumConstant enum_constant;
enum_constant.name = en.name();
enum_constant.comment = parse_comment(en);
enum_constant.parent_name = cpp_enum.name();
if (en.value().has_value())
{
Expand Down Expand Up @@ -1082,6 +1084,7 @@ namespace terra
json["type"] = typeJson;

json["is_mutable"] = node->is_mutable;
json["comment"] = node->comment;
json["access_specifier"] = node->access_specifier;
}

Expand All @@ -1091,6 +1094,7 @@ namespace terra
json["name"] = node->name;
json["value"] = node->value;
json["source"] = node->source;
json["comment"] = node->comment;
}
};

Expand Down

0 comments on commit e4bda11

Please sign in to comment.