Skip to content

Commit

Permalink
Handle properly empty yaggo file
Browse files Browse the repository at this point in the history
* Generate proper constructor code even if no arg or option is
  defined.
  • Loading branch information
gmarcais committed Jul 27, 2023
1 parent 2fd3f59 commit 72ed45f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/yaggo/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@ class #{class_name} {
end

# Constructors and initialization
h.puts("", " #{class_name}() :")
h.puts(" " + ($options + $args).map { |o| o.init }.join(",\n "), " { }")
h.puts("", " #{class_name}(int argc, char* argv[]) :")
h.puts(" " + ($options + $args).map { |o| o.init }.join(",\n "))
h.puts("", " #{class_name}()")
h.puts(" :" + ($options + $args).map { |o| o.init }.join("\n ,")) unless $options.empty? && $args.empty?
h.puts(" { }")
h.puts("", " #{class_name}(int argc, char* argv[])")
h.puts(" :" + ($options + $args).map { |o| o.init }.join("\n ,")) unless $options.empty? && $args.empty?
h.puts(" { parse(argc, argv); }", "");

# Main arsing function
Expand Down

0 comments on commit 72ed45f

Please sign in to comment.