From 929f27b5e4ee1f0ff7093f216f87cd78546e1d65 Mon Sep 17 00:00:00 2001 From: ydah <13041216+ydah@users.noreply.github.com> Date: Sat, 7 Oct 2023 01:46:33 +0900 Subject: [PATCH] If already included, change to not add --- lib/lrama/new_parser.rb | 2 +- parser.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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