diff --git a/lib/lrama/new_parser.rb b/lib/lrama/new_parser.rb index 418e5cd3..08b60a7f 100644 --- a/lib/lrama/new_parser.rb +++ b/lib/lrama/new_parser.rb @@ -32,7 +32,7 @@ def next_token end def prologue(s_value) - if @header_path + if @header_path && !s_value.match?(/^\s*#include\s+"#{@header_path}"/) "\n#include \"#{@header_path}\"\n" + s_value else s_value diff --git a/parser.y b/parser.y index 9a0a2ee8..9775c3ce 100644 --- a/parser.y +++ b/parser.y @@ -385,7 +385,7 @@ def next_token end def prologue(s_value) - if @header_path + if @header_path && !s_value.match?(/^\s*#include\s+"#{@header_path}"/) "\n#include \"#{@header_path}\"\n" + s_value else s_value