Skip to content

Commit

Permalink
Expand embedded paths so that the guards can find it
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jun 10, 2023
1 parent f12af30 commit 31ac4f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ file 'lib/racc/parser-text.rb' => ['lib/racc/parser.rb', __FILE__] do |t|

text = File.read(source)
text.gsub!(/^require '(.*)'$/) do
%[unless $".find {|p| p.end_with?('/#$1.rb')}\n$".push '#$1.rb'\n#{File.read("lib/#{$1}.rb")}\nend\n]
%[unless $".find {|p| p.end_with?('/#$1.rb')}\n$".push "\#{__dir__}/#$1.rb"\n#{File.read("lib/#{$1}.rb")}\nend\n]
rescue
$&
end
Expand Down
4 changes: 2 additions & 2 deletions lib/racc/parserfilegenerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def runtime_source

def embed_library(src)
line %[###### #{src.filename} begin]
line %[unless $".index '#{src.filename}']
line %[$".push '#{src.filename}']
line %[unless $".find {|p| p.end_with?('/#{src.filename}')}]
line %[$".push "\#{__dir__}/#{src.filename}"]
put src, @params.convert_line?
line %[end]
line %[###### #{src.filename} end]
Expand Down

0 comments on commit 31ac4f0

Please sign in to comment.